poke 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.
- package/dist/cli.cjs +74 -68
- package/package.json +1 -1
package/dist/cli.cjs
CHANGED
|
@@ -1,31 +1,31 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
"use strict";var
|
|
3
|
-
`).replace(/^/gm," ".repeat(s))}let c=[`Usage: ${t.commandUsage(e)}`,""],u=t.commandDescription(e);u.length>0&&(c=c.concat([t.wrap(u,n,0),""]));let
|
|
4
|
-
`)}padWidth(e,t){return Math.max(t.longestOptionTermLength(e,t),t.longestGlobalOptionTermLength(e,t),t.longestSubcommandTermLength(e,t),t.longestArgumentTermLength(e,t))}wrap(e,t,r,n=40){let s=" \\f\\t\\v\xA0\u1680\u2000-\u200A\u202F\u205F\u3000\uFEFF",o=new RegExp(`[\\n][${s}]+`);if(e.match(o))return e;let
|
|
2
|
+
"use strict";var lr=Object.create;var Ze=Object.defineProperty;var cr=Object.getOwnPropertyDescriptor;var ur=Object.getOwnPropertyNames;var hr=Object.getPrototypeOf,fr=Object.prototype.hasOwnProperty;var dr=(i,e)=>()=>(i&&(e=i(i=0)),e);var T=(i,e)=>()=>(e||i((e={exports:{}}).exports,e),e.exports);var mr=(i,e,t,r)=>{if(e&&typeof e=="object"||typeof e=="function")for(let n of ur(e))!fr.call(i,n)&&n!==t&&Ze(i,n,{get:()=>e[n],enumerable:!(r=cr(e,n))||r.enumerable});return i};var A=(i,e,t)=>(t=i!=null?lr(hr(i)):{},mr(e||!i||!i.__esModule?Ze(t,"default",{value:i,enumerable:!0}):t,i));var et,p,h=dr(()=>{"use strict";et=require("url"),p=(0,et.pathToFileURL)(__filename).href});var K=T(de=>{h();var z=class extends Error{constructor(e,t,r){super(r),Error.captureStackTrace(this,this.constructor),this.name=this.constructor.name,this.code=t,this.exitCode=e,this.nestedError=void 0}},fe=class extends z{constructor(e){super(1,"commander.invalidArgument",e),Error.captureStackTrace(this,this.constructor),this.name=this.constructor.name}};de.CommanderError=z;de.InvalidArgumentError=fe});var Z=T(pe=>{h();var{InvalidArgumentError:pr}=K(),me=class{constructor(e,t){switch(this.description=t||"",this.variadic=!1,this.parseArg=void 0,this.defaultValue=void 0,this.defaultValueDescription=void 0,this.argChoices=void 0,e[0]){case"<":this.required=!0,this.e=e.slice(1,-1);break;case"[":this.required=!1,this.e=e.slice(1,-1);break;default:this.required=!0,this.e=e;break}this.e.length>3&&this.e.slice(-3)==="..."&&(this.variadic=!0,this.e=this.e.slice(0,-3))}name(){return this.e}A(e,t){return t===this.defaultValue||!Array.isArray(t)?[e]:t.concat(e)}default(e,t){return this.defaultValue=e,this.defaultValueDescription=t,this}argParser(e){return this.parseArg=e,this}choices(e){return this.argChoices=e.slice(),this.parseArg=(t,r)=>{if(!this.argChoices.includes(t))throw new pr(`Allowed choices are ${this.argChoices.join(", ")}.`);return this.variadic?this.A(t,r):t},this}argRequired(){return this.required=!0,this}argOptional(){return this.required=!1,this}};function gr(i){let e=i.name()+(i.variadic===!0?"...":"");return i.required?"<"+e+">":"["+e+"]"}pe.Argument=me;pe.humanReadableArgName=gr});var we=T(tt=>{h();var{humanReadableArgName:wr}=Z(),ge=class{constructor(){this.helpWidth=void 0,this.sortSubcommands=!1,this.sortOptions=!1,this.showGlobalOptions=!1}visibleCommands(e){let t=e.commands.filter(n=>!n.E),r=e.g();return r&&!r.E&&t.push(r),this.sortSubcommands&&t.sort((n,s)=>n.name().localeCompare(s.name())),t}compareOptions(e,t){let r=n=>n.short?n.short.replace(/^-/,""):n.long.replace(/^--/,"");return r(e).localeCompare(r(t))}visibleOptions(e){let t=e.options.filter(n=>!n.hidden),r=e.h();if(r&&!r.hidden){let n=r.short&&e.i(r.short),s=r.long&&e.i(r.long);!n&&!s?t.push(r):r.long&&!s?t.push(e.createOption(r.long,r.description)):r.short&&!n&&t.push(e.createOption(r.short,r.description))}return this.sortOptions&&t.sort(this.compareOptions),t}visibleGlobalOptions(e){if(!this.showGlobalOptions)return[];let t=[];for(let r=e.parent;r;r=r.parent){let n=r.options.filter(s=>!s.hidden);t.push(...n)}return this.sortOptions&&t.sort(this.compareOptions),t}visibleArguments(e){return e.D&&e.registeredArguments.forEach(t=>{t.description=t.description||e.D[t.name()]||""}),e.registeredArguments.find(t=>t.description)?e.registeredArguments:[]}subcommandTerm(e){let t=e.registeredArguments.map(r=>wr(r)).join(" ");return e.e+(e.o[0]?"|"+e.o[0]:"")+(e.options.length?" [options]":"")+(t?" "+t:"")}optionTerm(e){return e.flags}argumentTerm(e){return e.name()}longestSubcommandTermLength(e,t){return t.visibleCommands(e).reduce((r,n)=>Math.max(r,t.subcommandTerm(n).length),0)}longestOptionTermLength(e,t){return t.visibleOptions(e).reduce((r,n)=>Math.max(r,t.optionTerm(n).length),0)}longestGlobalOptionTermLength(e,t){return t.visibleGlobalOptions(e).reduce((r,n)=>Math.max(r,t.optionTerm(n).length),0)}longestArgumentTermLength(e,t){return t.visibleArguments(e).reduce((r,n)=>Math.max(r,t.argumentTerm(n).length),0)}commandUsage(e){let t=e.e;e.o[0]&&(t=t+"|"+e.o[0]);let r="";for(let n=e.parent;n;n=n.parent)r=n.name()+" "+r;return r+t+" "+e.usage()}commandDescription(e){return e.description()}subcommandDescription(e){return e.summary()||e.description()}optionDescription(e){let t=[];return e.argChoices&&t.push(`choices: ${e.argChoices.map(r=>JSON.stringify(r)).join(", ")}`),e.defaultValue!==void 0&&(e.required||e.optional||e.isBoolean()&&typeof e.defaultValue=="boolean")&&t.push(`default: ${e.defaultValueDescription||JSON.stringify(e.defaultValue)}`),e.presetArg!==void 0&&e.optional&&t.push(`preset: ${JSON.stringify(e.presetArg)}`),e.envVar!==void 0&&t.push(`env: ${e.envVar}`),t.length>0?`${e.description} (${t.join(", ")})`:e.description}argumentDescription(e){let t=[];if(e.argChoices&&t.push(`choices: ${e.argChoices.map(r=>JSON.stringify(r)).join(", ")}`),e.defaultValue!==void 0&&t.push(`default: ${e.defaultValueDescription||JSON.stringify(e.defaultValue)}`),t.length>0){let r=`(${t.join(", ")})`;return e.description?`${e.description} ${r}`:r}return e.description}formatHelp(e,t){let r=t.padWidth(e,t),n=t.helpWidth||80,s=2,o=2;function a(d,f){if(f){let y=`${d.padEnd(r+o)}${f}`;return t.wrap(y,n-s,r+o)}return d}function l(d){return d.join(`
|
|
3
|
+
`).replace(/^/gm," ".repeat(s))}let c=[`Usage: ${t.commandUsage(e)}`,""],u=t.commandDescription(e);u.length>0&&(c=c.concat([t.wrap(u,n,0),""]));let m=t.visibleArguments(e).map(d=>a(t.argumentTerm(d),t.argumentDescription(d)));m.length>0&&(c=c.concat(["Arguments:",l(m),""]));let v=t.visibleOptions(e).map(d=>a(t.optionTerm(d),t.optionDescription(d)));if(v.length>0&&(c=c.concat(["Options:",l(v),""])),this.showGlobalOptions){let d=t.visibleGlobalOptions(e).map(f=>a(t.optionTerm(f),t.optionDescription(f)));d.length>0&&(c=c.concat(["Global Options:",l(d),""]))}let g=t.visibleCommands(e).map(d=>a(t.subcommandTerm(d),t.subcommandDescription(d)));return g.length>0&&(c=c.concat(["Commands:",l(g),""])),c.join(`
|
|
4
|
+
`)}padWidth(e,t){return Math.max(t.longestOptionTermLength(e,t),t.longestGlobalOptionTermLength(e,t),t.longestSubcommandTermLength(e,t),t.longestArgumentTermLength(e,t))}wrap(e,t,r,n=40){let s=" \\f\\t\\v\xA0\u1680\u2000-\u200A\u202F\u205F\u3000\uFEFF",o=new RegExp(`[\\n][${s}]+`);if(e.match(o))return e;let a=t-r;if(a<n)return e;let l=e.slice(0,r),c=e.slice(r).replace(`\r
|
|
5
5
|
`,`
|
|
6
|
-
`),u=" ".repeat(r),
|
|
7
|
-
|.{1,${
|
|
8
|
-
`?"":(
|
|
9
|
-
`)}};tt.Help=
|
|
6
|
+
`),u=" ".repeat(r),v="\\s\u200B",g=new RegExp(`
|
|
7
|
+
|.{1,${a-1}}([${v}]|$)|[^${v}]+?([${v}]|$)`,"g"),d=c.match(g)||[];return l+d.map((f,y)=>f===`
|
|
8
|
+
`?"":(y>0?u:"")+f.trimEnd()).join(`
|
|
9
|
+
`)}};tt.Help=ge});var Ee=T(Ae=>{h();var{InvalidArgumentError:vr}=K(),ve=class{constructor(e,t){this.flags=e,this.description=t||"",this.required=e.includes("<"),this.optional=e.includes("["),this.variadic=/\w\.\.\.[>\]]$/.test(e),this.mandatory=!1;let r=Ar(e);this.short=r.shortFlag,this.long=r.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(e,t){return this.defaultValue=e,this.defaultValueDescription=t,this}preset(e){return this.presetArg=e,this}conflicts(e){return this.conflictsWith=this.conflictsWith.concat(e),this}implies(e){let t=e;return typeof e=="string"&&(t={[e]:!0}),this.implied=Object.assign(this.implied||{},t),this}env(e){return this.envVar=e,this}argParser(e){return this.parseArg=e,this}makeOptionMandatory(e=!0){return this.mandatory=!!e,this}hideHelp(e=!0){return this.hidden=!!e,this}A(e,t){return t===this.defaultValue||!Array.isArray(t)?[e]:t.concat(e)}choices(e){return this.argChoices=e.slice(),this.parseArg=(t,r)=>{if(!this.argChoices.includes(t))throw new vr(`Allowed choices are ${this.argChoices.join(", ")}.`);return this.variadic?this.A(t,r):t},this}name(){return this.long?this.long.replace(/^--/,""):this.short.replace(/^-/,"")}attributeName(){return yr(this.name().replace(/^no-/,""))}is(e){return this.short===e||this.long===e}isBoolean(){return!this.required&&!this.optional&&!this.negate}},ye=class{constructor(e){this.positiveOptions=new Map,this.negativeOptions=new Map,this.dualOptions=new Set,e.forEach(t=>{t.negate?this.negativeOptions.set(t.attributeName(),t):this.positiveOptions.set(t.attributeName(),t)}),this.negativeOptions.forEach((t,r)=>{this.positiveOptions.has(r)&&this.dualOptions.add(r)})}valueFromOption(e,t){let r=t.attributeName();if(!this.dualOptions.has(r))return!0;let n=this.negativeOptions.get(r).presetArg,s=n!==void 0?n:!1;return t.negate===(s===e)}};function yr(i){return i.split("-").reduce((e,t)=>e+t[0].toUpperCase()+t.slice(1))}function Ar(i){let e,t,r=i.split(/[ |,]+/);return r.length>1&&!/^[[<]/.test(r[1])&&(e=r.shift()),t=r.shift(),!e&&/^-[^-]$/.test(t)&&(e=t,t=void 0),{shortFlag:e,longFlag:t}}Ae.Option=ve;Ae.DualOptions=ye});var nt=T(rt=>{h();function Er(i,e){if(Math.abs(i.length-e.length)>3)return Math.max(i.length,e.length);let t=[];for(let r=0;r<=i.length;r++)t[r]=[r];for(let r=0;r<=e.length;r++)t[0][r]=r;for(let r=1;r<=e.length;r++)for(let n=1;n<=i.length;n++){let s=1;i[n-1]===e[r-1]?s=0:s=1,t[n][r]=Math.min(t[n-1][r]+1,t[n][r-1]+1,t[n-1][r-1]+s),n>1&&r>1&&i[n-1]===e[r-2]&&i[n-2]===e[r-1]&&(t[n][r]=Math.min(t[n][r],t[n-2][r-2]+1))}return t[i.length][e.length]}function br(i,e){if(!e||e.length===0)return"";e=Array.from(new Set(e));let t=i.startsWith("--");t&&(i=i.slice(2),e=e.map(o=>o.slice(2)));let r=[],n=3,s=.4;return e.forEach(o=>{if(o.length<=1)return;let a=Er(i,o),l=Math.max(i.length,o.length);(l-a)/l>s&&(a<n?(n=a,r=[o]):a===n&&r.push(o))}),r.sort((o,a)=>o.localeCompare(a)),t&&(r=r.map(o=>`--${o}`)),r.length>1?`
|
|
10
10
|
(Did you mean one of ${r.join(", ")}?)`:r.length===1?`
|
|
11
|
-
(Did you mean ${r[0]}?)`:""}rt.suggestSimilar=
|
|
12
|
-
- specify the name in Command constructor or using .name()`);return t=t||{},t.isDefault&&(this.f=e.e),(t.noHelp||t.hidden)&&(e.E=!0),this.W(e),e.parent=this,e.j(),this}createArgument(e,t){return new
|
|
13
|
-
Expecting one of '${r.join("', '")}'`);return this.c[e]?this.c[e].push(t):this.c[e]=[t],this}exitOverride(e){return e?this.l=e:this.l=t=>{if(t.code!=="commander.executeSubCommandAsync")throw t},this}S(e,t,r){this.l&&this.l(new Te(e,t,r)),
|
|
14
|
-
- already used by option '${t.flags}'`)}this.options.push(e)}W(e){let t=n=>[n.name()].concat(n.aliases()),r=t(e).find(n=>this.s(n));if(r){let n=t(this.s(r)).join("|"),s=t(e).join("|");throw new Error(`cannot add command '${s}' as already have command '${n}'`)}this.commands.push(e)}addOption(e){this.G(e);let t=e.name(),r=e.attributeName();if(e.negate){let s=e.long.replace(/^--no-/,"--");this.i(s)||this.setOptionValueWithSource(r,e.defaultValue===void 0?!0:e.defaultValue,"default")}else e.defaultValue!==void 0&&this.setOptionValueWithSource(r,e.defaultValue,"default");let n=(s,o,
|
|
11
|
+
(Did you mean ${r[0]}?)`:""}rt.suggestSimilar=br});var lt=T(at=>{h();var xr=require("node:events").EventEmitter,be=require("node:child_process"),R=require("node:path"),xe=require("node:fs"),E=require("node:process"),{Argument:Tr,humanReadableArgName:Pr}=Z(),{CommanderError:Te}=K(),{Help:Cr}=we(),{Option:it,DualOptions:Or}=Ee(),{suggestSimilar:st}=nt(),Pe=class i extends xr{constructor(e){super(),this.commands=[],this.options=[],this.parent=null,this.N=!1,this.b=!0,this.registeredArguments=[],this.de=this.registeredArguments,this.args=[],this.rawArgs=[],this.processedArgs=[],this.r=null,this.e=e||"",this.x={},this.F={},this.a=!1,this.w=null,this.T=!1,this.R=null,this.I=null,this.f=null,this.l=null,this.o=[],this.P=!0,this.V="",this.U="",this.D=void 0,this.d=!1,this.C=!1,this.c={},this.m=!1,this.v=!0,this.t={writeOut:t=>E.stdout.write(t),writeErr:t=>E.stderr.write(t),getOutHelpWidth:()=>E.stdout.isTTY?E.stdout.columns:void 0,getErrHelpWidth:()=>E.stderr.isTTY?E.stderr.columns:void 0,outputError:(t,r)=>r(t)},this.E=!1,this.n=void 0,this.O=void 0,this.p=void 0,this.$={}}copyInheritedSettings(e){return this.t=e.t,this.n=e.n,this.p=e.p,this.$=e.$,this.l=e.l,this.a=e.a,this.P=e.P,this.b=e.b,this.d=e.d,this.m=e.m,this.v=e.v,this}u(){let e=[];for(let t=this;t;t=t.parent)e.push(t);return e}command(e,t,r){let n=t,s=r;typeof n=="object"&&n!==null&&(s=n,n=null),s=s||{};let[,o,a]=e.match(/([^ ]+) *(.*)/),l=this.createCommand(o);return n&&(l.description(n),l.T=!0),s.isDefault&&(this.f=l.e),l.E=!!(s.noHelp||s.hidden),l.R=s.executableFile||null,a&&l.arguments(a),this.W(l),l.parent=this,l.copyInheritedSettings(this),n?this:l}createCommand(e){return new i(e)}createHelp(){return Object.assign(new Cr,this.configureHelp())}configureHelp(e){return e===void 0?this.$:(this.$=e,this)}configureOutput(e){return e===void 0?this.t:(Object.assign(this.t,e),this)}showHelpAfterError(e=!0){return typeof e!="string"&&(e=!!e),this.m=e,this}showSuggestionAfterError(e=!0){return this.v=!!e,this}addCommand(e,t){if(!e.e)throw new Error(`Command passed to .addCommand() must have a name
|
|
12
|
+
- specify the name in Command constructor or using .name()`);return t=t||{},t.isDefault&&(this.f=e.e),(t.noHelp||t.hidden)&&(e.E=!0),this.W(e),e.parent=this,e.j(),this}createArgument(e,t){return new Tr(e,t)}argument(e,t,r,n){let s=this.createArgument(e,t);return typeof r=="function"?s.default(n).argParser(r):s.default(r),this.addArgument(s),this}arguments(e){return e.trim().split(/ +/).forEach(t=>{this.argument(t)}),this}addArgument(e){let t=this.registeredArguments.slice(-1)[0];if(t&&t.variadic)throw new Error(`only the last argument can be variadic '${t.name()}'`);if(e.required&&e.defaultValue!==void 0&&e.parseArg===void 0)throw new Error(`a default value for a required argument is never used: '${e.name()}'`);return this.registeredArguments.push(e),this}helpCommand(e,t){if(typeof e=="boolean")return this.O=e,this;e=e??"help [command]";let[,r,n]=e.match(/([^ ]+) *(.*)/),s=t??"display help for command",o=this.createCommand(r);return o.helpOption(!1),n&&o.arguments(n),s&&o.description(s),this.O=!0,this.p=o,this}addHelpCommand(e,t){return typeof e!="object"?(this.helpCommand(e,t),this):(this.O=!0,this.p=e,this)}g(){return this.O??(this.commands.length&&!this.w&&!this.s("help"))?(this.p===void 0&&this.helpCommand(void 0,void 0),this.p):null}hook(e,t){let r=["preSubcommand","preAction","postAction"];if(!r.includes(e))throw new Error(`Unexpected value for event passed to hook : '${e}'.
|
|
13
|
+
Expecting one of '${r.join("', '")}'`);return this.c[e]?this.c[e].push(t):this.c[e]=[t],this}exitOverride(e){return e?this.l=e:this.l=t=>{if(t.code!=="commander.executeSubCommandAsync")throw t},this}S(e,t,r){this.l&&this.l(new Te(e,t,r)),E.exit(e)}action(e){let t=r=>{let n=this.registeredArguments.length,s=r.slice(0,n);return this.a?s[n]=this:s[n]=this.opts(),s.push(this),e.apply(this,s)};return this.w=t,this}createOption(e,t){return new it(e,t)}q(e,t,r,n){try{return e.parseArg(t,r)}catch(s){if(s.code==="commander.invalidArgument"){let o=`${n} ${s.message}`;this.error(o,{exitCode:s.exitCode,code:s.code})}throw s}}G(e){let t=e.short&&this.i(e.short)||e.long&&this.i(e.long);if(t){let r=e.long&&this.i(e.long)?e.long:e.short;throw new Error(`Cannot add option '${e.flags}'${this.e&&` to command '${this.e}'`} due to conflicting flag '${r}'
|
|
14
|
+
- already used by option '${t.flags}'`)}this.options.push(e)}W(e){let t=n=>[n.name()].concat(n.aliases()),r=t(e).find(n=>this.s(n));if(r){let n=t(this.s(r)).join("|"),s=t(e).join("|");throw new Error(`cannot add command '${s}' as already have command '${n}'`)}this.commands.push(e)}addOption(e){this.G(e);let t=e.name(),r=e.attributeName();if(e.negate){let s=e.long.replace(/^--no-/,"--");this.i(s)||this.setOptionValueWithSource(r,e.defaultValue===void 0?!0:e.defaultValue,"default")}else e.defaultValue!==void 0&&this.setOptionValueWithSource(r,e.defaultValue,"default");let n=(s,o,a)=>{s==null&&e.presetArg!==void 0&&(s=e.presetArg);let l=this.getOptionValue(r);s!==null&&e.parseArg?s=this.q(e,s,l,o):s!==null&&e.variadic&&(s=e.A(s,l)),s==null&&(e.negate?s=!1:e.isBoolean()||e.optional?s=!0:s=""),this.setOptionValueWithSource(r,s,a)};return this.on("option:"+t,s=>{let o=`error: option '${e.flags}' argument '${s}' is invalid.`;n(s,o,"cli")}),e.envVar&&this.on("optionEnv:"+t,s=>{let o=`error: option '${e.flags}' value '${s}' from env '${e.envVar}' is invalid.`;n(s,o,"env")}),this}K(e,t,r,n,s){if(typeof t=="object"&&t instanceof it)throw new Error("To add an Option object use addOption() instead of option() or requiredOption()");let o=this.createOption(t,r);if(o.makeOptionMandatory(!!e.mandatory),typeof n=="function")o.default(s).argParser(n);else if(n instanceof RegExp){let a=n;n=(l,c)=>{let u=a.exec(l);return u?u[0]:c},o.default(s).argParser(n)}else o.default(n);return this.addOption(o)}option(e,t,r,n){return this.K({},e,t,r,n)}requiredOption(e,t,r,n){return this.K({mandatory:!0},e,t,r,n)}combineFlagAndOptionalValue(e=!0){return this.P=!!e,this}allowUnknownOption(e=!0){return this.N=!!e,this}allowExcessArguments(e=!0){return this.b=!!e,this}enablePositionalOptions(e=!0){return this.d=!!e,this}passThroughOptions(e=!0){return this.C=!!e,this.j(),this}j(){if(this.parent&&this.C&&!this.parent.d)throw new Error(`passThroughOptions cannot be used for '${this.e}' without turning on enablePositionalOptions for parent command(s)`)}storeOptionsAsProperties(e=!0){if(this.options.length)throw new Error("call .storeOptionsAsProperties() before adding options");if(Object.keys(this.x).length)throw new Error("call .storeOptionsAsProperties() before setting option values");return this.a=!!e,this}getOptionValue(e){return this.a?this[e]:this.x[e]}setOptionValue(e,t){return this.setOptionValueWithSource(e,t,void 0)}setOptionValueWithSource(e,t,r){return this.a?this[e]=t:this.x[e]=t,this.F[e]=r,this}getOptionValueSource(e){return this.F[e]}getOptionValueSourceWithGlobals(e){let t;return this.u().forEach(r=>{r.getOptionValueSource(e)!==void 0&&(t=r.getOptionValueSource(e))}),t}J(e,t){if(e!==void 0&&!Array.isArray(e))throw new Error("first parameter to parse must be array or undefined");if(t=t||{},e===void 0&&t.from===void 0){E.versions?.electron&&(t.from="electron");let n=E.execArgv??[];(n.includes("-e")||n.includes("--eval")||n.includes("-p")||n.includes("--print"))&&(t.from="eval")}e===void 0&&(e=E.argv),this.rawArgs=e.slice();let r;switch(t.from){case void 0:case"node":this.r=e[1],r=e.slice(2);break;case"electron":E.defaultApp?(this.r=e[1],r=e.slice(2)):r=e.slice(1);break;case"user":r=e.slice(0);break;case"eval":r=e.slice(1);break;default:throw new Error(`unexpected parse option { from: '${t.from}' }`)}return!this.e&&this.r&&this.nameFromFilename(this.r),this.e=this.e||"program",r}parse(e,t){let r=this.J(e,t);return this._([],r),this}async parseAsync(e,t){let r=this.J(e,t);return await this._([],r),this}re(e,t){t=t.slice();let r=!1,n=[".js",".ts",".tsx",".mjs",".cjs"];function s(u,m){let v=R.resolve(u,m);if(xe.existsSync(v))return v;if(n.includes(R.extname(m)))return;let g=n.find(d=>xe.existsSync(`${v}${d}`));if(g)return`${v}${g}`}this.X(),this.Y();let o=e.R||`${this.e}-${e.e}`,a=this.I||"";if(this.r){let u;try{u=xe.realpathSync(this.r)}catch{u=this.r}a=R.resolve(R.dirname(u),a)}if(a){let u=s(a,o);if(!u&&!e.R&&this.r){let m=R.basename(this.r,R.extname(this.r));m!==this.e&&(u=s(a,`${m}-${e.e}`))}o=u||o}r=n.includes(R.extname(o));let l;E.platform!=="win32"?r?(t.unshift(o),t=ot(E.execArgv).concat(t),l=be.spawn(E.argv[0],t,{stdio:"inherit"})):l=be.spawn(o,t,{stdio:"inherit"}):(t.unshift(o),t=ot(E.execArgv).concat(t),l=be.spawn(E.execPath,t,{stdio:"inherit"})),l.killed||["SIGUSR1","SIGUSR2","SIGTERM","SIGINT","SIGHUP"].forEach(m=>{E.on(m,()=>{l.killed===!1&&l.exitCode===null&&l.kill(m)})});let c=this.l;l.on("close",u=>{u=u??1,c?c(new Te(u,"commander.executeSubCommandAsync","(close)")):E.exit(u)}),l.on("error",u=>{if(u.code==="ENOENT"){let m=a?`searched for local subcommand relative to directory '${a}'`:"no directory for search for local subcommand, use .executableDir() to supply a custom directory",v=`'${o}' does not exist
|
|
15
15
|
- if '${e.e}' is not meant to be an executable command, remove description parameter from '.command()' and use '.description()' instead
|
|
16
16
|
- if the default executable name is not suitable, use the executableFile option to supply a custom name or path
|
|
17
|
-
- ${
|
|
17
|
+
- ${m}`;throw new Error(v)}else if(u.code==="EACCES")throw new Error(`'${o}' not executable`);if(!c)E.exit(1);else{let m=new Te(1,"commander.executeSubCommandAsync","(error)");m.nestedError=u,c(m)}}),this.runningCommand=l}k(e,t,r){let n=this.s(e);n||this.help({error:!0});let s;return s=this.ne(s,n,"preSubcommand"),s=this.y(s,()=>{if(n.T)this.re(n,t.concat(r));else return n._(t,r)}),s}ie(e){e||this.help();let t=this.s(e);return t&&!t.T&&t.help(),this.k(e,[],[this.h()?.long??this.h()?.short??"--help"])}se(){this.registeredArguments.forEach((e,t)=>{e.required&&this.args[t]==null&&this.missingArgument(e.name())}),!(this.registeredArguments.length>0&&this.registeredArguments[this.registeredArguments.length-1].variadic)&&this.args.length>this.registeredArguments.length&&this.oe(this.args)}B(){let e=(r,n,s)=>{let o=n;if(n!==null&&r.parseArg){let a=`error: command-argument value '${n}' is invalid for argument '${r.name()}'.`;o=this.q(r,n,s,a)}return o};this.se();let t=[];this.registeredArguments.forEach((r,n)=>{let s=r.defaultValue;r.variadic?n<this.args.length?(s=this.args.slice(n),r.parseArg&&(s=s.reduce((o,a)=>e(r,a,o),r.defaultValue))):s===void 0&&(s=[]):n<this.args.length&&(s=this.args[n],r.parseArg&&(s=e(r,s,r.defaultValue))),t[n]=s}),this.processedArgs=t}y(e,t){return e&&e.then&&typeof e.then=="function"?e.then(()=>t()):t()}z(e,t){let r=e,n=[];return this.u().reverse().filter(s=>s.c[t]!==void 0).forEach(s=>{s.c[t].forEach(o=>{n.push({hookedCommand:s,callback:o})})}),t==="postAction"&&n.reverse(),n.forEach(s=>{r=this.y(r,()=>s.callback(s.hookedCommand,this))}),r}ne(e,t,r){let n=e;return this.c[r]!==void 0&&this.c[r].forEach(s=>{n=this.y(n,()=>s(this,t))}),n}_(e,t){let r=this.parseOptions(t);if(this.ae(),this.le(),e=e.concat(r.operands),t=r.unknown,this.args=e.concat(t),e&&this.s(e[0]))return this.k(e[0],e.slice(1),t);if(this.g()&&e[0]===this.g().name())return this.ie(e[1]);if(this.f)return this.Z(t),this.k(this.f,e,t);this.commands.length&&this.args.length===0&&!this.w&&!this.f&&this.help({error:!0}),this.Z(r.unknown),this.X(),this.Y();let n=()=>{r.unknown.length>0&&this.unknownOption(r.unknown[0])},s=`command:${this.name()}`;if(this.w){n(),this.B();let o;return o=this.z(o,"preAction"),o=this.y(o,()=>this.w(this.processedArgs)),this.parent&&(o=this.y(o,()=>{this.parent.emit(s,e,t)})),o=this.z(o,"postAction"),o}if(this.parent&&this.parent.listenerCount(s))n(),this.B(),this.parent.emit(s,e,t);else if(e.length){if(this.s("*"))return this.k("*",e,t);this.listenerCount("command:*")?this.emit("command:*",e,t):this.commands.length?this.unknownCommand():(n(),this.B())}else this.commands.length?(n(),this.help({error:!0})):(n(),this.B())}s(e){if(e)return this.commands.find(t=>t.e===e||t.o.includes(e))}i(e){return this.options.find(t=>t.is(e))}X(){this.u().forEach(e=>{e.options.forEach(t=>{t.mandatory&&e.getOptionValue(t.attributeName())===void 0&&e.missingMandatoryOptionValue(t)})})}ce(){let e=this.options.filter(r=>{let n=r.attributeName();return this.getOptionValue(n)===void 0?!1:this.getOptionValueSource(n)!=="default"});e.filter(r=>r.conflictsWith.length>0).forEach(r=>{let n=e.find(s=>r.conflictsWith.includes(s.attributeName()));n&&this.ue(r,n)})}Y(){this.u().forEach(e=>{e.ce()})}parseOptions(e){let t=[],r=[],n=t,s=e.slice();function o(l){return l.length>1&&l[0]==="-"}let a=null;for(;s.length;){let l=s.shift();if(l==="--"){n===r&&n.push(l),n.push(...s);break}if(a&&!o(l)){this.emit(`option:${a.name()}`,l);continue}if(a=null,o(l)){let c=this.i(l);if(c){if(c.required){let u=s.shift();u===void 0&&this.optionMissingArgument(c),this.emit(`option:${c.name()}`,u)}else if(c.optional){let u=null;s.length>0&&!o(s[0])&&(u=s.shift()),this.emit(`option:${c.name()}`,u)}else this.emit(`option:${c.name()}`);a=c.variadic?c:null;continue}}if(l.length>2&&l[0]==="-"&&l[1]!=="-"){let c=this.i(`-${l[1]}`);if(c){c.required||c.optional&&this.P?this.emit(`option:${c.name()}`,l.slice(2)):(this.emit(`option:${c.name()}`),s.unshift(`-${l.slice(2)}`));continue}}if(/^--[^=]+=/.test(l)){let c=l.indexOf("="),u=this.i(l.slice(0,c));if(u&&(u.required||u.optional)){this.emit(`option:${u.name()}`,l.slice(c+1));continue}}if(o(l)&&(n=r),(this.d||this.C)&&t.length===0&&r.length===0){if(this.s(l)){t.push(l),s.length>0&&r.push(...s);break}else if(this.g()&&l===this.g().name()){t.push(l),s.length>0&&t.push(...s);break}else if(this.f){r.push(l),s.length>0&&r.push(...s);break}}if(this.C){n.push(l),s.length>0&&n.push(...s);break}n.push(l)}return{operands:t,unknown:r}}opts(){if(this.a){let e={},t=this.options.length;for(let r=0;r<t;r++){let n=this.options[r].attributeName();e[n]=n===this.he?this.ee:this[n]}return e}return this.x}optsWithGlobals(){return this.u().reduce((e,t)=>Object.assign(e,t.opts()),{})}error(e,t){this.t.outputError(`${e}
|
|
18
18
|
`,this.t.writeErr),typeof this.m=="string"?this.t.writeErr(`${this.m}
|
|
19
19
|
`):this.m&&(this.t.writeErr(`
|
|
20
|
-
`),this.outputHelp({error:!0}));let r=t||{},n=r.exitCode||1,s=r.code||"commander.error";this.S(n,s,e)}ae(){this.options.forEach(e=>{if(e.envVar&&e.envVar in
|
|
21
|
-
`),this.S(0,"commander.version",e)}),this}description(e,t){return e===void 0&&t===void 0?this.V:(this.V=e,t&&(this.
|
|
20
|
+
`),this.outputHelp({error:!0}));let r=t||{},n=r.exitCode||1,s=r.code||"commander.error";this.S(n,s,e)}ae(){this.options.forEach(e=>{if(e.envVar&&e.envVar in E.env){let t=e.attributeName();(this.getOptionValue(t)===void 0||["default","config","env"].includes(this.getOptionValueSource(t)))&&(e.required||e.optional?this.emit(`optionEnv:${e.name()}`,E.env[e.envVar]):this.emit(`optionEnv:${e.name()}`))}})}le(){let e=new Or(this.options),t=r=>this.getOptionValue(r)!==void 0&&!["default","implied"].includes(this.getOptionValueSource(r));this.options.filter(r=>r.implied!==void 0&&t(r.attributeName())&&e.valueFromOption(this.getOptionValue(r.attributeName()),r)).forEach(r=>{Object.keys(r.implied).filter(n=>!t(n)).forEach(n=>{this.setOptionValueWithSource(n,r.implied[n],"implied")})})}missingArgument(e){let t=`error: missing required argument '${e}'`;this.error(t,{code:"commander.missingArgument"})}optionMissingArgument(e){let t=`error: option '${e.flags}' argument missing`;this.error(t,{code:"commander.optionMissingArgument"})}missingMandatoryOptionValue(e){let t=`error: required option '${e.flags}' not specified`;this.error(t,{code:"commander.missingMandatoryOptionValue"})}ue(e,t){let r=o=>{let a=o.attributeName(),l=this.getOptionValue(a),c=this.options.find(m=>m.negate&&a===m.attributeName()),u=this.options.find(m=>!m.negate&&a===m.attributeName());return c&&(c.presetArg===void 0&&l===!1||c.presetArg!==void 0&&l===c.presetArg)?c:u||o},n=o=>{let a=r(o),l=a.attributeName();return this.getOptionValueSource(l)==="env"?`environment variable '${a.envVar}'`:`option '${a.flags}'`},s=`error: ${n(e)} cannot be used with ${n(t)}`;this.error(s,{code:"commander.conflictingOption"})}unknownOption(e){if(this.N)return;let t="";if(e.startsWith("--")&&this.v){let n=[],s=this;do{let o=s.createHelp().visibleOptions(s).filter(a=>a.long).map(a=>a.long);n=n.concat(o),s=s.parent}while(s&&!s.d);t=st(e,n)}let r=`error: unknown option '${e}'${t}`;this.error(r,{code:"commander.unknownOption"})}oe(e){if(this.b)return;let t=this.registeredArguments.length,r=t===1?"":"s",s=`error: too many arguments${this.parent?` for '${this.name()}'`:""}. Expected ${t} argument${r} but got ${e.length}.`;this.error(s,{code:"commander.excessArguments"})}unknownCommand(){let e=this.args[0],t="";if(this.v){let n=[];this.createHelp().visibleCommands(this).forEach(s=>{n.push(s.name()),s.alias()&&n.push(s.alias())}),t=st(e,n)}let r=`error: unknown command '${e}'${t}`;this.error(r,{code:"commander.unknownCommand"})}version(e,t,r){if(e===void 0)return this.ee;this.ee=e,t=t||"-V, --version",r=r||"output the version number";let n=this.createOption(t,r);return this.he=n.attributeName(),this.G(n),this.on("option:"+n.name(),()=>{this.t.writeOut(`${e}
|
|
21
|
+
`),this.S(0,"commander.version",e)}),this}description(e,t){return e===void 0&&t===void 0?this.V:(this.V=e,t&&(this.D=t),this)}summary(e){return e===void 0?this.U:(this.U=e,this)}alias(e){if(e===void 0)return this.o[0];let t=this;if(this.commands.length!==0&&this.commands[this.commands.length-1].T&&(t=this.commands[this.commands.length-1]),e===t.e)throw new Error("Command alias can't be the same as its name");let r=this.parent?.s(e);if(r){let n=[r.name()].concat(r.aliases()).join("|");throw new Error(`cannot add alias '${e}' to command '${this.name()}' as already have command '${n}'`)}return t.o.push(e),this}aliases(e){return e===void 0?this.o:(e.forEach(t=>this.alias(t)),this)}usage(e){if(e===void 0){if(this.te)return this.te;let t=this.registeredArguments.map(r=>Pr(r));return[].concat(this.options.length||this.n!==null?"[options]":[],this.commands.length?"[command]":[],this.registeredArguments.length?t:[]).join(" ")}return this.te=e,this}name(e){return e===void 0?this.e:(this.e=e,this)}nameFromFilename(e){return this.e=R.basename(e,R.extname(e)),this}executableDir(e){return e===void 0?this.I:(this.I=e,this)}helpInformation(e){let t=this.createHelp();return t.helpWidth===void 0&&(t.helpWidth=e&&e.error?this.t.getErrHelpWidth():this.t.getOutHelpWidth()),t.formatHelp(this,t)}fe(e){e=e||{};let t={error:!!e.error},r;return t.error?r=n=>this.t.writeErr(n):r=n=>this.t.writeOut(n),t.write=e.write||r,t.command=this,t}outputHelp(e){let t;typeof e=="function"&&(t=e,e=void 0);let r=this.fe(e);this.u().reverse().forEach(s=>s.emit("beforeAllHelp",r)),this.emit("beforeHelp",r);let n=this.helpInformation(r);if(t&&(n=t(n),typeof n!="string"&&!Buffer.isBuffer(n)))throw new Error("outputHelp callback must return a string or a Buffer");r.write(n),this.h()?.long&&this.emit(this.h().long),this.emit("afterHelp",r),this.u().forEach(s=>s.emit("afterAllHelp",r))}helpOption(e,t){return typeof e=="boolean"?(e?this.n=this.n??void 0:this.n=null,this):(e=e??"-h, --help",t=t??"display help for command",this.n=this.createOption(e,t),this)}h(){return this.n===void 0&&this.helpOption(void 0,void 0),this.n}addHelpOption(e){return this.n=e,this}help(e){this.outputHelp(e);let t=E.exitCode||0;t===0&&e&&typeof e!="function"&&e.error&&(t=1),this.S(t,"commander.help","(outputHelp)")}addHelpText(e,t){let r=["beforeAll","before","after","afterAll"];if(!r.includes(e))throw new Error(`Unexpected value for position to addHelpText.
|
|
22
22
|
Expecting one of '${r.join("', '")}'`);let n=`${e}Help`;return this.on(n,s=>{let o;typeof t=="function"?o=t({error:s.error,command:s.command}):o=t,o&&s.write(`${o}
|
|
23
|
-
`)}),this}Z(e){let t=this.h();t&&e.find(n=>t.is(n))&&(this.outputHelp(),this.S(0,"commander.helpDisplayed","(outputHelp)"))}};function ot(i){return i.map(e=>{if(!e.startsWith("--inspect"))return e;let t,r="127.0.0.1",n="9229",s;return(s=e.match(/^(--inspect(-brk)?)$/))!==null?t=s[1]:(s=e.match(/^(--inspect(-brk|-port)?)=([^:]+)$/))!==null?(t=s[1],/^\d+$/.test(s[3])?n=s[3]:r=s[3]):(s=e.match(/^(--inspect(-brk|-port)?)=([^:]+):(\d+)$/))!==null&&(t=s[1],r=s[3],n=s[4]),t&&n!=="0"?`${t}=${r}:${parseInt(n)+1}`:e})}at.Command=Pe});var ft=b(P=>{h();var{Argument:ct}=ee(),{Command:Oe}=lt(),{CommanderError:Lr,InvalidArgumentError:ut}=G(),{Help:kr}=ve(),{Option:ht}=be();P.program=new Oe;P.createCommand=i=>new Oe(i);P.createOption=(i,e)=>new ht(i,e);P.createArgument=(i,e)=>new ct(i,e);P.Command=Oe;P.Option=ht;P.Argument=ct;P.Help=kr;P.CommanderError=Lr;P.InvalidArgumentError=ut;P.InvalidOptionArgumentError=ut});var qe=b((yi,Rt)=>{h();Rt.exports={MODE_NUMBER:1,MODE_ALPHA_NUM:2,MODE_8BIT_BYTE:4,MODE_KANJI:8}});var Ht=b((Ei,Nt)=>{h();var Gr=qe();function _t(i){this.mode=Gr.MODE_8BIT_BYTE,this.data=i}_t.prototype={getLength:function(){return this.data.length},write:function(i){for(var e=0;e<this.data.length;e++)i.put(this.data.charCodeAt(e),8)}};Nt.exports=_t});var Ge=b((xi,Ft)=>{h();var S={glog:function(i){if(i<1)throw new Error("glog("+i+")");return S.LOG_TABLE[i]},gexp:function(i){for(;i<0;)i+=255;for(;i>=256;)i-=255;return S.EXP_TABLE[i]},EXP_TABLE:new Array(256),LOG_TABLE:new Array(256)};for(A=0;A<8;A++)S.EXP_TABLE[A]=1<<A;var A;for(A=8;A<256;A++)S.EXP_TABLE[A]=S.EXP_TABLE[A-4]^S.EXP_TABLE[A-5]^S.EXP_TABLE[A-6]^S.EXP_TABLE[A-8];var A;for(A=0;A<255;A++)S.LOG_TABLE[S.EXP_TABLE[A]]=A;var A;Ft.exports=S});var Ke=b((Ti,Vt)=>{h();var U=Ge();function oe(i,e){if(i.length===void 0)throw new Error(i.length+"/"+e);for(var t=0;t<i.length&&i[t]===0;)t++;this.num=new Array(i.length-t+e);for(var r=0;r<i.length-t;r++)this.num[r]=i[r+t]}oe.prototype={get:function(i){return this.num[i]},getLength:function(){return this.num.length},multiply:function(i){for(var e=new Array(this.getLength()+i.getLength()-1),t=0;t<this.getLength();t++)for(var r=0;r<i.getLength();r++)e[t+r]^=U.gexp(U.glog(this.get(t))+U.glog(i.get(r)));return new oe(e,0)},mod:function(i){if(this.getLength()-i.getLength()<0)return this;for(var e=U.glog(this.get(0))-U.glog(i.get(0)),t=new Array(this.getLength()),r=0;r<this.getLength();r++)t[r]=this.get(r);for(var n=0;n<i.getLength();n++)t[n]^=U.gexp(U.glog(i.get(n))+e);return new oe(t,0).mod(i)}};Vt.exports=oe});var Wt=b((Oi,Ut)=>{h();Ut.exports={PATTERN000:0,PATTERN001:1,PATTERN010:2,PATTERN011:3,PATTERN100:4,PATTERN101:5,PATTERN110:6,PATTERN111:7}});var Gt=b((Si,qt)=>{h();var O=qe(),jt=Ke(),Kr=Ge(),_=Wt(),C={PATTERN_POSITION_TABLE:[[],[6,18],[6,22],[6,26],[6,30],[6,34],[6,22,38],[6,24,42],[6,26,46],[6,28,50],[6,30,54],[6,32,58],[6,34,62],[6,26,46,66],[6,26,48,70],[6,26,50,74],[6,30,54,78],[6,30,56,82],[6,30,58,86],[6,34,62,90],[6,28,50,72,94],[6,26,50,74,98],[6,30,54,78,102],[6,28,54,80,106],[6,32,58,84,110],[6,30,58,86,114],[6,34,62,90,118],[6,26,50,74,98,122],[6,30,54,78,102,126],[6,26,52,78,104,130],[6,30,56,82,108,134],[6,34,60,86,112,138],[6,30,58,86,114,142],[6,34,62,90,118,146],[6,30,54,78,102,126,150],[6,24,50,76,102,128,154],[6,28,54,80,106,132,158],[6,32,58,84,110,136,162],[6,26,54,82,110,138,166],[6,30,58,86,114,142,170]],G15:1335,G18:7973,G15_MASK:21522,getBCHTypeInfo:function(i){for(var e=i<<10;C.getBCHDigit(e)-C.getBCHDigit(C.G15)>=0;)e^=C.G15<<C.getBCHDigit(e)-C.getBCHDigit(C.G15);return(i<<10|e)^C.G15_MASK},getBCHTypeNumber:function(i){for(var e=i<<12;C.getBCHDigit(e)-C.getBCHDigit(C.G18)>=0;)e^=C.G18<<C.getBCHDigit(e)-C.getBCHDigit(C.G18);return i<<12|e},getBCHDigit:function(i){for(var e=0;i!==0;)e++,i>>>=1;return e},getPatternPosition:function(i){return C.PATTERN_POSITION_TABLE[i-1]},getMask:function(i,e,t){switch(i){case _.PATTERN000:return(e+t)%2===0;case _.PATTERN001:return e%2===0;case _.PATTERN010:return t%3===0;case _.PATTERN011:return(e+t)%3===0;case _.PATTERN100:return(Math.floor(e/2)+Math.floor(t/3))%2===0;case _.PATTERN101:return e*t%2+e*t%3===0;case _.PATTERN110:return(e*t%2+e*t%3)%2===0;case _.PATTERN111:return(e*t%3+(e+t)%2)%2===0;default:throw new Error("bad maskPattern:"+i)}},getErrorCorrectPolynomial:function(i){for(var e=new jt([1],0),t=0;t<i;t++)e=e.multiply(new jt([1,Kr.gexp(t)],0));return e},getLengthInBits:function(i,e){if(1<=e&&e<10)switch(i){case O.MODE_NUMBER:return 10;case O.MODE_ALPHA_NUM:return 9;case O.MODE_8BIT_BYTE:return 8;case O.MODE_KANJI:return 8;default:throw new Error("mode:"+i)}else if(e<27)switch(i){case O.MODE_NUMBER:return 12;case O.MODE_ALPHA_NUM:return 11;case O.MODE_8BIT_BYTE:return 16;case O.MODE_KANJI:return 10;default:throw new Error("mode:"+i)}else if(e<41)switch(i){case O.MODE_NUMBER:return 14;case O.MODE_ALPHA_NUM:return 13;case O.MODE_8BIT_BYTE:return 16;case O.MODE_KANJI:return 12;default:throw new Error("mode:"+i)}else throw new Error("type:"+e)},getLostPoint:function(i){var e=i.getModuleCount(),t=0,r=0,n=0;for(r=0;r<e;r++)for(n=0;n<e;n++){for(var s=0,o=i.isDark(r,n),l=-1;l<=1;l++)if(!(r+l<0||e<=r+l))for(var a=-1;a<=1;a++)n+a<0||e<=n+a||l===0&&a===0||o===i.isDark(r+l,n+a)&&s++;s>5&&(t+=3+s-5)}for(r=0;r<e-1;r++)for(n=0;n<e-1;n++){var c=0;i.isDark(r,n)&&c++,i.isDark(r+1,n)&&c++,i.isDark(r,n+1)&&c++,i.isDark(r+1,n+1)&&c++,(c===0||c===4)&&(t+=3)}for(r=0;r<e;r++)for(n=0;n<e-6;n++)i.isDark(r,n)&&!i.isDark(r,n+1)&&i.isDark(r,n+2)&&i.isDark(r,n+3)&&i.isDark(r,n+4)&&!i.isDark(r,n+5)&&i.isDark(r,n+6)&&(t+=40);for(n=0;n<e;n++)for(r=0;r<e-6;r++)i.isDark(r,n)&&!i.isDark(r+1,n)&&i.isDark(r+2,n)&&i.isDark(r+3,n)&&i.isDark(r+4,n)&&!i.isDark(r+5,n)&&i.isDark(r+6,n)&&(t+=40);var u=0;for(n=0;n<e;n++)for(r=0;r<e;r++)i.isDark(r,n)&&u++;var d=Math.abs(100*u/e/e-50)/5;return t+=d*10,t}};qt.exports=C});var Qe=b((ki,Kt)=>{h();Kt.exports={L:1,M:0,Q:3,H:2}});var Jt=b((Mi,Qt)=>{h();var ae=Qe();function k(i,e){this.totalCount=i,this.dataCount=e}k.RS_BLOCK_TABLE=[[1,26,19],[1,26,16],[1,26,13],[1,26,9],[1,44,34],[1,44,28],[1,44,22],[1,44,16],[1,70,55],[1,70,44],[2,35,17],[2,35,13],[1,100,80],[2,50,32],[2,50,24],[4,25,9],[1,134,108],[2,67,43],[2,33,15,2,34,16],[2,33,11,2,34,12],[2,86,68],[4,43,27],[4,43,19],[4,43,15],[2,98,78],[4,49,31],[2,32,14,4,33,15],[4,39,13,1,40,14],[2,121,97],[2,60,38,2,61,39],[4,40,18,2,41,19],[4,40,14,2,41,15],[2,146,116],[3,58,36,2,59,37],[4,36,16,4,37,17],[4,36,12,4,37,13],[2,86,68,2,87,69],[4,69,43,1,70,44],[6,43,19,2,44,20],[6,43,15,2,44,16],[4,101,81],[1,80,50,4,81,51],[4,50,22,4,51,23],[3,36,12,8,37,13],[2,116,92,2,117,93],[6,58,36,2,59,37],[4,46,20,6,47,21],[7,42,14,4,43,15],[4,133,107],[8,59,37,1,60,38],[8,44,20,4,45,21],[12,33,11,4,34,12],[3,145,115,1,146,116],[4,64,40,5,65,41],[11,36,16,5,37,17],[11,36,12,5,37,13],[5,109,87,1,110,88],[5,65,41,5,66,42],[5,54,24,7,55,25],[11,36,12],[5,122,98,1,123,99],[7,73,45,3,74,46],[15,43,19,2,44,20],[3,45,15,13,46,16],[1,135,107,5,136,108],[10,74,46,1,75,47],[1,50,22,15,51,23],[2,42,14,17,43,15],[5,150,120,1,151,121],[9,69,43,4,70,44],[17,50,22,1,51,23],[2,42,14,19,43,15],[3,141,113,4,142,114],[3,70,44,11,71,45],[17,47,21,4,48,22],[9,39,13,16,40,14],[3,135,107,5,136,108],[3,67,41,13,68,42],[15,54,24,5,55,25],[15,43,15,10,44,16],[4,144,116,4,145,117],[17,68,42],[17,50,22,6,51,23],[19,46,16,6,47,17],[2,139,111,7,140,112],[17,74,46],[7,54,24,16,55,25],[34,37,13],[4,151,121,5,152,122],[4,75,47,14,76,48],[11,54,24,14,55,25],[16,45,15,14,46,16],[6,147,117,4,148,118],[6,73,45,14,74,46],[11,54,24,16,55,25],[30,46,16,2,47,17],[8,132,106,4,133,107],[8,75,47,13,76,48],[7,54,24,22,55,25],[22,45,15,13,46,16],[10,142,114,2,143,115],[19,74,46,4,75,47],[28,50,22,6,51,23],[33,46,16,4,47,17],[8,152,122,4,153,123],[22,73,45,3,74,46],[8,53,23,26,54,24],[12,45,15,28,46,16],[3,147,117,10,148,118],[3,73,45,23,74,46],[4,54,24,31,55,25],[11,45,15,31,46,16],[7,146,116,7,147,117],[21,73,45,7,74,46],[1,53,23,37,54,24],[19,45,15,26,46,16],[5,145,115,10,146,116],[19,75,47,10,76,48],[15,54,24,25,55,25],[23,45,15,25,46,16],[13,145,115,3,146,116],[2,74,46,29,75,47],[42,54,24,1,55,25],[23,45,15,28,46,16],[17,145,115],[10,74,46,23,75,47],[10,54,24,35,55,25],[19,45,15,35,46,16],[17,145,115,1,146,116],[14,74,46,21,75,47],[29,54,24,19,55,25],[11,45,15,46,46,16],[13,145,115,6,146,116],[14,74,46,23,75,47],[44,54,24,7,55,25],[59,46,16,1,47,17],[12,151,121,7,152,122],[12,75,47,26,76,48],[39,54,24,14,55,25],[22,45,15,41,46,16],[6,151,121,14,152,122],[6,75,47,34,76,48],[46,54,24,10,55,25],[2,45,15,64,46,16],[17,152,122,4,153,123],[29,74,46,14,75,47],[49,54,24,10,55,25],[24,45,15,46,46,16],[4,152,122,18,153,123],[13,74,46,32,75,47],[48,54,24,14,55,25],[42,45,15,32,46,16],[20,147,117,4,148,118],[40,75,47,7,76,48],[43,54,24,22,55,25],[10,45,15,67,46,16],[19,148,118,6,149,119],[18,75,47,31,76,48],[34,54,24,34,55,25],[20,45,15,61,46,16]];k.getRSBlocks=function(i,e){var t=k.getRsBlockTable(i,e);if(t===void 0)throw new Error("bad rs block @ typeNumber:"+i+"/errorCorrectLevel:"+e);for(var r=t.length/3,n=[],s=0;s<r;s++)for(var o=t[s*3+0],l=t[s*3+1],a=t[s*3+2],c=0;c<o;c++)n.push(new k(l,a));return n};k.getRsBlockTable=function(i,e){switch(e){case ae.L:return k.RS_BLOCK_TABLE[(i-1)*4+0];case ae.M:return k.RS_BLOCK_TABLE[(i-1)*4+1];case ae.Q:return k.RS_BLOCK_TABLE[(i-1)*4+2];case ae.H:return k.RS_BLOCK_TABLE[(i-1)*4+3];default:return}};Qt.exports=k});var zt=b((Di,Yt)=>{h();function Xt(){this.buffer=[],this.length=0}Xt.prototype={get:function(i){var e=Math.floor(i/8);return(this.buffer[e]>>>7-i%8&1)==1},put:function(i,e){for(var t=0;t<e;t++)this.putBit((i>>>e-t-1&1)==1)},getLengthInBits:function(){return this.length},putBit:function(i){var e=Math.floor(this.length/8);this.buffer.length<=e&&this.buffer.push(0),i&&(this.buffer[e]|=128>>>this.length%8),this.length++}};Yt.exports=Xt});var rr=b((_i,tr)=>{h();var Qr=Ht(),N=Gt(),Jr=Ke(),Zt=Jt(),er=zt();function B(i,e){this.typeNumber=i,this.errorCorrectLevel=e,this.modules=null,this.moduleCount=0,this.dataCache=null,this.dataList=[]}B.prototype={addData:function(i){var e=new Qr(i);this.dataList.push(e),this.dataCache=null},isDark:function(i,e){if(i<0||this.moduleCount<=i||e<0||this.moduleCount<=e)throw new Error(i+","+e);return this.modules[i][e]},getModuleCount:function(){return this.moduleCount},make:function(){if(this.typeNumber<1){var i=1;for(i=1;i<40;i++){for(var e=Zt.getRSBlocks(i,this.errorCorrectLevel),t=new er,r=0,n=0;n<e.length;n++)r+=e[n].dataCount;for(var s=0;s<this.dataList.length;s++){var o=this.dataList[s];t.put(o.mode,4),t.put(o.getLength(),N.getLengthInBits(o.mode,i)),o.write(t)}if(t.getLengthInBits()<=r*8)break}this.typeNumber=i}this.makeImpl(!1,this.getBestMaskPattern())},makeImpl:function(i,e){this.moduleCount=this.typeNumber*4+17,this.modules=new Array(this.moduleCount);for(var t=0;t<this.moduleCount;t++){this.modules[t]=new Array(this.moduleCount);for(var r=0;r<this.moduleCount;r++)this.modules[t][r]=null}this.setupPositionProbePattern(0,0),this.setupPositionProbePattern(this.moduleCount-7,0),this.setupPositionProbePattern(0,this.moduleCount-7),this.setupPositionAdjustPattern(),this.setupTimingPattern(),this.setupTypeInfo(i,e),this.typeNumber>=7&&this.setupTypeNumber(i),this.dataCache===null&&(this.dataCache=B.createData(this.typeNumber,this.errorCorrectLevel,this.dataList)),this.mapData(this.dataCache,e)},setupPositionProbePattern:function(i,e){for(var t=-1;t<=7;t++)if(!(i+t<=-1||this.moduleCount<=i+t))for(var r=-1;r<=7;r++)e+r<=-1||this.moduleCount<=e+r||(0<=t&&t<=6&&(r===0||r===6)||0<=r&&r<=6&&(t===0||t===6)||2<=t&&t<=4&&2<=r&&r<=4?this.modules[i+t][e+r]=!0:this.modules[i+t][e+r]=!1)},getBestMaskPattern:function(){for(var i=0,e=0,t=0;t<8;t++){this.makeImpl(!0,t);var r=N.getLostPoint(this);(t===0||i>r)&&(i=r,e=t)}return e},createMovieClip:function(i,e,t){var r=i.createEmptyMovieClip(e,t),n=1;this.make();for(var s=0;s<this.modules.length;s++)for(var o=s*n,l=0;l<this.modules[s].length;l++){var a=l*n,c=this.modules[s][l];c&&(r.beginFill(0,100),r.moveTo(a,o),r.lineTo(a+n,o),r.lineTo(a+n,o+n),r.lineTo(a,o+n),r.endFill())}return r},setupTimingPattern:function(){for(var i=8;i<this.moduleCount-8;i++)this.modules[i][6]===null&&(this.modules[i][6]=i%2===0);for(var e=8;e<this.moduleCount-8;e++)this.modules[6][e]===null&&(this.modules[6][e]=e%2===0)},setupPositionAdjustPattern:function(){for(var i=N.getPatternPosition(this.typeNumber),e=0;e<i.length;e++)for(var t=0;t<i.length;t++){var r=i[e],n=i[t];if(this.modules[r][n]===null)for(var s=-2;s<=2;s++)for(var o=-2;o<=2;o++)Math.abs(s)===2||Math.abs(o)===2||s===0&&o===0?this.modules[r+s][n+o]=!0:this.modules[r+s][n+o]=!1}},setupTypeNumber:function(i){for(var e=N.getBCHTypeNumber(this.typeNumber),t,r=0;r<18;r++)t=!i&&(e>>r&1)===1,this.modules[Math.floor(r/3)][r%3+this.moduleCount-8-3]=t;for(var n=0;n<18;n++)t=!i&&(e>>n&1)===1,this.modules[n%3+this.moduleCount-8-3][Math.floor(n/3)]=t},setupTypeInfo:function(i,e){for(var t=this.errorCorrectLevel<<3|e,r=N.getBCHTypeInfo(t),n,s=0;s<15;s++)n=!i&&(r>>s&1)===1,s<6?this.modules[s][8]=n:s<8?this.modules[s+1][8]=n:this.modules[this.moduleCount-15+s][8]=n;for(var o=0;o<15;o++)n=!i&&(r>>o&1)===1,o<8?this.modules[8][this.moduleCount-o-1]=n:o<9?this.modules[8][15-o-1+1]=n:this.modules[8][15-o-1]=n;this.modules[this.moduleCount-8][8]=!i},mapData:function(i,e){for(var t=-1,r=this.moduleCount-1,n=7,s=0,o=this.moduleCount-1;o>0;o-=2)for(o===6&&o--;;){for(var l=0;l<2;l++)if(this.modules[r][o-l]===null){var a=!1;s<i.length&&(a=(i[s]>>>n&1)===1);var c=N.getMask(e,r,o-l);c&&(a=!a),this.modules[r][o-l]=a,n--,n===-1&&(s++,n=7)}if(r+=t,r<0||this.moduleCount<=r){r-=t,t=-t;break}}}};B.PAD0=236;B.PAD1=17;B.createData=function(i,e,t){for(var r=Zt.getRSBlocks(i,e),n=new er,s=0;s<t.length;s++){var o=t[s];n.put(o.mode,4),n.put(o.getLength(),N.getLengthInBits(o.mode,i)),o.write(n)}for(var l=0,a=0;a<r.length;a++)l+=r[a].dataCount;if(n.getLengthInBits()>l*8)throw new Error("code length overflow. ("+n.getLengthInBits()+">"+l*8+")");for(n.getLengthInBits()+4<=l*8&&n.put(0,4);n.getLengthInBits()%8!==0;)n.putBit(!1);for(;!(n.getLengthInBits()>=l*8||(n.put(B.PAD0,8),n.getLengthInBits()>=l*8));)n.put(B.PAD1,8);return B.createBytes(n,r)};B.createBytes=function(i,e){for(var t=0,r=0,n=0,s=new Array(e.length),o=new Array(e.length),l=0;l<e.length;l++){var a=e[l].dataCount,c=e[l].totalCount-a;r=Math.max(r,a),n=Math.max(n,c),s[l]=new Array(a);for(var u=0;u<s[l].length;u++)s[l][u]=255&i.buffer[u+t];t+=a;var d=N.getErrorCorrectPolynomial(c),w=new Jr(s[l],d.getLength()-1),m=w.mod(d);o[l]=new Array(d.getLength()-1);for(var f=0;f<o[l].length;f++){var x=f+m.getLength()-o[l].length;o[l][f]=x>=0?m.get(x):0}}for(var L=0,W=0;W<e.length;W++)L+=e[W].totalCount;for(var g=new Array(L),E=0,$=0;$<r;$++)for(var X=0;X<e.length;X++)$<s[X].length&&(g[E++]=s[X][$]);for(var Y=0;Y<n;Y++)for(var z=0;z<e.length;z++)Y<o[z].length&&(g[E++]=o[z][Y]);return g};tr.exports=B});var Xe=b((Hi,ir)=>{h();var Xr=rr(),nr=Qe(),Yr="\x1B[40m \x1B[0m",le="\x1B[47m \x1B[0m",zr=function(i){return i?Yr:le},Je=function(i){return{times:function(e){return new Array(e).join(i)}}},Zr=function(i,e){for(var t=new Array(i),r=0;r<i;r++)t[r]=e;return t};ir.exports={error:nr.L,generate:function(i,e,t){typeof e=="function"&&(t=e,e={});var r=new Xr(-1,this.error);r.addData(i),r.make();var n="";if(e&&e.small){var s=!0,o=!1,l=r.getModuleCount(),a=r.modules.slice(),c=l%2===1;c&&a.push(Zr(l,o));var u={WHITE_ALL:"\u2588",WHITE_BLACK:"\u2580",BLACK_WHITE:"\u2584",BLACK_ALL:" "},d=Je(u.BLACK_WHITE).times(l+3),w=Je(u.WHITE_BLACK).times(l+3);n+=d+`
|
|
24
|
-
`;for(var
|
|
25
|
-
`}c||(n+=
|
|
26
|
-
`,r.modules.forEach(function(
|
|
27
|
-
`}),n+=
|
|
28
|
-
tell application "System Events" to get value of property list item "CFBundleName" of property list file (app_path & ":Contents:Info.plist")`)}h();var
|
|
23
|
+
`)}),this}Z(e){let t=this.h();t&&e.find(n=>t.is(n))&&(this.outputHelp(),this.S(0,"commander.helpDisplayed","(outputHelp)"))}};function ot(i){return i.map(e=>{if(!e.startsWith("--inspect"))return e;let t,r="127.0.0.1",n="9229",s;return(s=e.match(/^(--inspect(-brk)?)$/))!==null?t=s[1]:(s=e.match(/^(--inspect(-brk|-port)?)=([^:]+)$/))!==null?(t=s[1],/^\d+$/.test(s[3])?n=s[3]:r=s[3]):(s=e.match(/^(--inspect(-brk|-port)?)=([^:]+):(\d+)$/))!==null&&(t=s[1],r=s[3],n=s[4]),t&&n!=="0"?`${t}=${r}:${parseInt(n)+1}`:e})}at.Command=Pe});var ft=T(C=>{h();var{Argument:ct}=Z(),{Command:Ce}=lt(),{CommanderError:$r,InvalidArgumentError:ut}=K(),{Help:Sr}=we(),{Option:ht}=Ee();C.program=new Ce;C.createCommand=i=>new Ce(i);C.createOption=(i,e)=>new ht(i,e);C.createArgument=(i,e)=>new ct(i,e);C.Command=Ce;C.Option=ht;C.Argument=ct;C.Help=Sr;C.CommanderError=$r;C.InvalidArgumentError=ut;C.InvalidOptionArgumentError=ut});var je=T((wi,Rt)=>{h();Rt.exports={MODE_NUMBER:1,MODE_ALPHA_NUM:2,MODE_8BIT_BYTE:4,MODE_KANJI:8}});var Nt=T((yi,_t)=>{h();var jr=je();function It(i){this.mode=jr.MODE_8BIT_BYTE,this.data=i}It.prototype={getLength:function(){return this.data.length},write:function(i){for(var e=0;e<this.data.length;e++)i.put(this.data.charCodeAt(e),8)}};_t.exports=It});var qe=T((Ei,Ht)=>{h();var S={glog:function(i){if(i<1)throw new Error("glog("+i+")");return S.LOG_TABLE[i]},gexp:function(i){for(;i<0;)i+=255;for(;i>=256;)i-=255;return S.EXP_TABLE[i]},EXP_TABLE:new Array(256),LOG_TABLE:new Array(256)};for(x=0;x<8;x++)S.EXP_TABLE[x]=1<<x;var x;for(x=8;x<256;x++)S.EXP_TABLE[x]=S.EXP_TABLE[x-4]^S.EXP_TABLE[x-5]^S.EXP_TABLE[x-6]^S.EXP_TABLE[x-8];var x;for(x=0;x<255;x++)S.LOG_TABLE[S.EXP_TABLE[x]]=x;var x;Ht.exports=S});var Ge=T((xi,Ft)=>{h();var W=qe();function oe(i,e){if(i.length===void 0)throw new Error(i.length+"/"+e);for(var t=0;t<i.length&&i[t]===0;)t++;this.num=new Array(i.length-t+e);for(var r=0;r<i.length-t;r++)this.num[r]=i[r+t]}oe.prototype={get:function(i){return this.num[i]},getLength:function(){return this.num.length},multiply:function(i){for(var e=new Array(this.getLength()+i.getLength()-1),t=0;t<this.getLength();t++)for(var r=0;r<i.getLength();r++)e[t+r]^=W.gexp(W.glog(this.get(t))+W.glog(i.get(r)));return new oe(e,0)},mod:function(i){if(this.getLength()-i.getLength()<0)return this;for(var e=W.glog(this.get(0))-W.glog(i.get(0)),t=new Array(this.getLength()),r=0;r<this.getLength();r++)t[r]=this.get(r);for(var n=0;n<i.getLength();n++)t[n]^=W.gexp(W.glog(i.get(n))+e);return new oe(t,0).mod(i)}};Ft.exports=oe});var Ut=T((Pi,Vt)=>{h();Vt.exports={PATTERN000:0,PATTERN001:1,PATTERN010:2,PATTERN011:3,PATTERN100:4,PATTERN101:5,PATTERN110:6,PATTERN111:7}});var qt=T((Oi,jt)=>{h();var O=je(),Wt=Ge(),qr=qe(),H=Ut(),P={PATTERN_POSITION_TABLE:[[],[6,18],[6,22],[6,26],[6,30],[6,34],[6,22,38],[6,24,42],[6,26,46],[6,28,50],[6,30,54],[6,32,58],[6,34,62],[6,26,46,66],[6,26,48,70],[6,26,50,74],[6,30,54,78],[6,30,56,82],[6,30,58,86],[6,34,62,90],[6,28,50,72,94],[6,26,50,74,98],[6,30,54,78,102],[6,28,54,80,106],[6,32,58,84,110],[6,30,58,86,114],[6,34,62,90,118],[6,26,50,74,98,122],[6,30,54,78,102,126],[6,26,52,78,104,130],[6,30,56,82,108,134],[6,34,60,86,112,138],[6,30,58,86,114,142],[6,34,62,90,118,146],[6,30,54,78,102,126,150],[6,24,50,76,102,128,154],[6,28,54,80,106,132,158],[6,32,58,84,110,136,162],[6,26,54,82,110,138,166],[6,30,58,86,114,142,170]],G15:1335,G18:7973,G15_MASK:21522,getBCHTypeInfo:function(i){for(var e=i<<10;P.getBCHDigit(e)-P.getBCHDigit(P.G15)>=0;)e^=P.G15<<P.getBCHDigit(e)-P.getBCHDigit(P.G15);return(i<<10|e)^P.G15_MASK},getBCHTypeNumber:function(i){for(var e=i<<12;P.getBCHDigit(e)-P.getBCHDigit(P.G18)>=0;)e^=P.G18<<P.getBCHDigit(e)-P.getBCHDigit(P.G18);return i<<12|e},getBCHDigit:function(i){for(var e=0;i!==0;)e++,i>>>=1;return e},getPatternPosition:function(i){return P.PATTERN_POSITION_TABLE[i-1]},getMask:function(i,e,t){switch(i){case H.PATTERN000:return(e+t)%2===0;case H.PATTERN001:return e%2===0;case H.PATTERN010:return t%3===0;case H.PATTERN011:return(e+t)%3===0;case H.PATTERN100:return(Math.floor(e/2)+Math.floor(t/3))%2===0;case H.PATTERN101:return e*t%2+e*t%3===0;case H.PATTERN110:return(e*t%2+e*t%3)%2===0;case H.PATTERN111:return(e*t%3+(e+t)%2)%2===0;default:throw new Error("bad maskPattern:"+i)}},getErrorCorrectPolynomial:function(i){for(var e=new Wt([1],0),t=0;t<i;t++)e=e.multiply(new Wt([1,qr.gexp(t)],0));return e},getLengthInBits:function(i,e){if(1<=e&&e<10)switch(i){case O.MODE_NUMBER:return 10;case O.MODE_ALPHA_NUM:return 9;case O.MODE_8BIT_BYTE:return 8;case O.MODE_KANJI:return 8;default:throw new Error("mode:"+i)}else if(e<27)switch(i){case O.MODE_NUMBER:return 12;case O.MODE_ALPHA_NUM:return 11;case O.MODE_8BIT_BYTE:return 16;case O.MODE_KANJI:return 10;default:throw new Error("mode:"+i)}else if(e<41)switch(i){case O.MODE_NUMBER:return 14;case O.MODE_ALPHA_NUM:return 13;case O.MODE_8BIT_BYTE:return 16;case O.MODE_KANJI:return 12;default:throw new Error("mode:"+i)}else throw new Error("type:"+e)},getLostPoint:function(i){var e=i.getModuleCount(),t=0,r=0,n=0;for(r=0;r<e;r++)for(n=0;n<e;n++){for(var s=0,o=i.isDark(r,n),a=-1;a<=1;a++)if(!(r+a<0||e<=r+a))for(var l=-1;l<=1;l++)n+l<0||e<=n+l||a===0&&l===0||o===i.isDark(r+a,n+l)&&s++;s>5&&(t+=3+s-5)}for(r=0;r<e-1;r++)for(n=0;n<e-1;n++){var c=0;i.isDark(r,n)&&c++,i.isDark(r+1,n)&&c++,i.isDark(r,n+1)&&c++,i.isDark(r+1,n+1)&&c++,(c===0||c===4)&&(t+=3)}for(r=0;r<e;r++)for(n=0;n<e-6;n++)i.isDark(r,n)&&!i.isDark(r,n+1)&&i.isDark(r,n+2)&&i.isDark(r,n+3)&&i.isDark(r,n+4)&&!i.isDark(r,n+5)&&i.isDark(r,n+6)&&(t+=40);for(n=0;n<e;n++)for(r=0;r<e-6;r++)i.isDark(r,n)&&!i.isDark(r+1,n)&&i.isDark(r+2,n)&&i.isDark(r+3,n)&&i.isDark(r+4,n)&&!i.isDark(r+5,n)&&i.isDark(r+6,n)&&(t+=40);var u=0;for(n=0;n<e;n++)for(r=0;r<e;r++)i.isDark(r,n)&&u++;var m=Math.abs(100*u/e/e-50)/5;return t+=m*10,t}};jt.exports=P});var Ke=T((Si,Gt)=>{h();Gt.exports={L:1,M:0,Q:3,H:2}});var Qt=T((ki,Kt)=>{h();var ae=Ke();function M(i,e){this.totalCount=i,this.dataCount=e}M.RS_BLOCK_TABLE=[[1,26,19],[1,26,16],[1,26,13],[1,26,9],[1,44,34],[1,44,28],[1,44,22],[1,44,16],[1,70,55],[1,70,44],[2,35,17],[2,35,13],[1,100,80],[2,50,32],[2,50,24],[4,25,9],[1,134,108],[2,67,43],[2,33,15,2,34,16],[2,33,11,2,34,12],[2,86,68],[4,43,27],[4,43,19],[4,43,15],[2,98,78],[4,49,31],[2,32,14,4,33,15],[4,39,13,1,40,14],[2,121,97],[2,60,38,2,61,39],[4,40,18,2,41,19],[4,40,14,2,41,15],[2,146,116],[3,58,36,2,59,37],[4,36,16,4,37,17],[4,36,12,4,37,13],[2,86,68,2,87,69],[4,69,43,1,70,44],[6,43,19,2,44,20],[6,43,15,2,44,16],[4,101,81],[1,80,50,4,81,51],[4,50,22,4,51,23],[3,36,12,8,37,13],[2,116,92,2,117,93],[6,58,36,2,59,37],[4,46,20,6,47,21],[7,42,14,4,43,15],[4,133,107],[8,59,37,1,60,38],[8,44,20,4,45,21],[12,33,11,4,34,12],[3,145,115,1,146,116],[4,64,40,5,65,41],[11,36,16,5,37,17],[11,36,12,5,37,13],[5,109,87,1,110,88],[5,65,41,5,66,42],[5,54,24,7,55,25],[11,36,12],[5,122,98,1,123,99],[7,73,45,3,74,46],[15,43,19,2,44,20],[3,45,15,13,46,16],[1,135,107,5,136,108],[10,74,46,1,75,47],[1,50,22,15,51,23],[2,42,14,17,43,15],[5,150,120,1,151,121],[9,69,43,4,70,44],[17,50,22,1,51,23],[2,42,14,19,43,15],[3,141,113,4,142,114],[3,70,44,11,71,45],[17,47,21,4,48,22],[9,39,13,16,40,14],[3,135,107,5,136,108],[3,67,41,13,68,42],[15,54,24,5,55,25],[15,43,15,10,44,16],[4,144,116,4,145,117],[17,68,42],[17,50,22,6,51,23],[19,46,16,6,47,17],[2,139,111,7,140,112],[17,74,46],[7,54,24,16,55,25],[34,37,13],[4,151,121,5,152,122],[4,75,47,14,76,48],[11,54,24,14,55,25],[16,45,15,14,46,16],[6,147,117,4,148,118],[6,73,45,14,74,46],[11,54,24,16,55,25],[30,46,16,2,47,17],[8,132,106,4,133,107],[8,75,47,13,76,48],[7,54,24,22,55,25],[22,45,15,13,46,16],[10,142,114,2,143,115],[19,74,46,4,75,47],[28,50,22,6,51,23],[33,46,16,4,47,17],[8,152,122,4,153,123],[22,73,45,3,74,46],[8,53,23,26,54,24],[12,45,15,28,46,16],[3,147,117,10,148,118],[3,73,45,23,74,46],[4,54,24,31,55,25],[11,45,15,31,46,16],[7,146,116,7,147,117],[21,73,45,7,74,46],[1,53,23,37,54,24],[19,45,15,26,46,16],[5,145,115,10,146,116],[19,75,47,10,76,48],[15,54,24,25,55,25],[23,45,15,25,46,16],[13,145,115,3,146,116],[2,74,46,29,75,47],[42,54,24,1,55,25],[23,45,15,28,46,16],[17,145,115],[10,74,46,23,75,47],[10,54,24,35,55,25],[19,45,15,35,46,16],[17,145,115,1,146,116],[14,74,46,21,75,47],[29,54,24,19,55,25],[11,45,15,46,46,16],[13,145,115,6,146,116],[14,74,46,23,75,47],[44,54,24,7,55,25],[59,46,16,1,47,17],[12,151,121,7,152,122],[12,75,47,26,76,48],[39,54,24,14,55,25],[22,45,15,41,46,16],[6,151,121,14,152,122],[6,75,47,34,76,48],[46,54,24,10,55,25],[2,45,15,64,46,16],[17,152,122,4,153,123],[29,74,46,14,75,47],[49,54,24,10,55,25],[24,45,15,46,46,16],[4,152,122,18,153,123],[13,74,46,32,75,47],[48,54,24,14,55,25],[42,45,15,32,46,16],[20,147,117,4,148,118],[40,75,47,7,76,48],[43,54,24,22,55,25],[10,45,15,67,46,16],[19,148,118,6,149,119],[18,75,47,31,76,48],[34,54,24,34,55,25],[20,45,15,61,46,16]];M.getRSBlocks=function(i,e){var t=M.getRsBlockTable(i,e);if(t===void 0)throw new Error("bad rs block @ typeNumber:"+i+"/errorCorrectLevel:"+e);for(var r=t.length/3,n=[],s=0;s<r;s++)for(var o=t[s*3+0],a=t[s*3+1],l=t[s*3+2],c=0;c<o;c++)n.push(new M(a,l));return n};M.getRsBlockTable=function(i,e){switch(e){case ae.L:return M.RS_BLOCK_TABLE[(i-1)*4+0];case ae.M:return M.RS_BLOCK_TABLE[(i-1)*4+1];case ae.Q:return M.RS_BLOCK_TABLE[(i-1)*4+2];case ae.H:return M.RS_BLOCK_TABLE[(i-1)*4+3];default:return}};Kt.exports=M});var Yt=T((Bi,Xt)=>{h();function Jt(){this.buffer=[],this.length=0}Jt.prototype={get:function(i){var e=Math.floor(i/8);return(this.buffer[e]>>>7-i%8&1)==1},put:function(i,e){for(var t=0;t<e;t++)this.putBit((i>>>e-t-1&1)==1)},getLengthInBits:function(){return this.length},putBit:function(i){var e=Math.floor(this.length/8);this.buffer.length<=e&&this.buffer.push(0),i&&(this.buffer[e]|=128>>>this.length%8),this.length++}};Xt.exports=Jt});var tr=T((Ri,er)=>{h();var Gr=Nt(),F=qt(),Kr=Ge(),zt=Qt(),Zt=Yt();function B(i,e){this.typeNumber=i,this.errorCorrectLevel=e,this.modules=null,this.moduleCount=0,this.dataCache=null,this.dataList=[]}B.prototype={addData:function(i){var e=new Gr(i);this.dataList.push(e),this.dataCache=null},isDark:function(i,e){if(i<0||this.moduleCount<=i||e<0||this.moduleCount<=e)throw new Error(i+","+e);return this.modules[i][e]},getModuleCount:function(){return this.moduleCount},make:function(){if(this.typeNumber<1){var i=1;for(i=1;i<40;i++){for(var e=zt.getRSBlocks(i,this.errorCorrectLevel),t=new Zt,r=0,n=0;n<e.length;n++)r+=e[n].dataCount;for(var s=0;s<this.dataList.length;s++){var o=this.dataList[s];t.put(o.mode,4),t.put(o.getLength(),F.getLengthInBits(o.mode,i)),o.write(t)}if(t.getLengthInBits()<=r*8)break}this.typeNumber=i}this.makeImpl(!1,this.getBestMaskPattern())},makeImpl:function(i,e){this.moduleCount=this.typeNumber*4+17,this.modules=new Array(this.moduleCount);for(var t=0;t<this.moduleCount;t++){this.modules[t]=new Array(this.moduleCount);for(var r=0;r<this.moduleCount;r++)this.modules[t][r]=null}this.setupPositionProbePattern(0,0),this.setupPositionProbePattern(this.moduleCount-7,0),this.setupPositionProbePattern(0,this.moduleCount-7),this.setupPositionAdjustPattern(),this.setupTimingPattern(),this.setupTypeInfo(i,e),this.typeNumber>=7&&this.setupTypeNumber(i),this.dataCache===null&&(this.dataCache=B.createData(this.typeNumber,this.errorCorrectLevel,this.dataList)),this.mapData(this.dataCache,e)},setupPositionProbePattern:function(i,e){for(var t=-1;t<=7;t++)if(!(i+t<=-1||this.moduleCount<=i+t))for(var r=-1;r<=7;r++)e+r<=-1||this.moduleCount<=e+r||(0<=t&&t<=6&&(r===0||r===6)||0<=r&&r<=6&&(t===0||t===6)||2<=t&&t<=4&&2<=r&&r<=4?this.modules[i+t][e+r]=!0:this.modules[i+t][e+r]=!1)},getBestMaskPattern:function(){for(var i=0,e=0,t=0;t<8;t++){this.makeImpl(!0,t);var r=F.getLostPoint(this);(t===0||i>r)&&(i=r,e=t)}return e},createMovieClip:function(i,e,t){var r=i.createEmptyMovieClip(e,t),n=1;this.make();for(var s=0;s<this.modules.length;s++)for(var o=s*n,a=0;a<this.modules[s].length;a++){var l=a*n,c=this.modules[s][a];c&&(r.beginFill(0,100),r.moveTo(l,o),r.lineTo(l+n,o),r.lineTo(l+n,o+n),r.lineTo(l,o+n),r.endFill())}return r},setupTimingPattern:function(){for(var i=8;i<this.moduleCount-8;i++)this.modules[i][6]===null&&(this.modules[i][6]=i%2===0);for(var e=8;e<this.moduleCount-8;e++)this.modules[6][e]===null&&(this.modules[6][e]=e%2===0)},setupPositionAdjustPattern:function(){for(var i=F.getPatternPosition(this.typeNumber),e=0;e<i.length;e++)for(var t=0;t<i.length;t++){var r=i[e],n=i[t];if(this.modules[r][n]===null)for(var s=-2;s<=2;s++)for(var o=-2;o<=2;o++)Math.abs(s)===2||Math.abs(o)===2||s===0&&o===0?this.modules[r+s][n+o]=!0:this.modules[r+s][n+o]=!1}},setupTypeNumber:function(i){for(var e=F.getBCHTypeNumber(this.typeNumber),t,r=0;r<18;r++)t=!i&&(e>>r&1)===1,this.modules[Math.floor(r/3)][r%3+this.moduleCount-8-3]=t;for(var n=0;n<18;n++)t=!i&&(e>>n&1)===1,this.modules[n%3+this.moduleCount-8-3][Math.floor(n/3)]=t},setupTypeInfo:function(i,e){for(var t=this.errorCorrectLevel<<3|e,r=F.getBCHTypeInfo(t),n,s=0;s<15;s++)n=!i&&(r>>s&1)===1,s<6?this.modules[s][8]=n:s<8?this.modules[s+1][8]=n:this.modules[this.moduleCount-15+s][8]=n;for(var o=0;o<15;o++)n=!i&&(r>>o&1)===1,o<8?this.modules[8][this.moduleCount-o-1]=n:o<9?this.modules[8][15-o-1+1]=n:this.modules[8][15-o-1]=n;this.modules[this.moduleCount-8][8]=!i},mapData:function(i,e){for(var t=-1,r=this.moduleCount-1,n=7,s=0,o=this.moduleCount-1;o>0;o-=2)for(o===6&&o--;;){for(var a=0;a<2;a++)if(this.modules[r][o-a]===null){var l=!1;s<i.length&&(l=(i[s]>>>n&1)===1);var c=F.getMask(e,r,o-a);c&&(l=!l),this.modules[r][o-a]=l,n--,n===-1&&(s++,n=7)}if(r+=t,r<0||this.moduleCount<=r){r-=t,t=-t;break}}}};B.PAD0=236;B.PAD1=17;B.createData=function(i,e,t){for(var r=zt.getRSBlocks(i,e),n=new Zt,s=0;s<t.length;s++){var o=t[s];n.put(o.mode,4),n.put(o.getLength(),F.getLengthInBits(o.mode,i)),o.write(n)}for(var a=0,l=0;l<r.length;l++)a+=r[l].dataCount;if(n.getLengthInBits()>a*8)throw new Error("code length overflow. ("+n.getLengthInBits()+">"+a*8+")");for(n.getLengthInBits()+4<=a*8&&n.put(0,4);n.getLengthInBits()%8!==0;)n.putBit(!1);for(;!(n.getLengthInBits()>=a*8||(n.put(B.PAD0,8),n.getLengthInBits()>=a*8));)n.put(B.PAD1,8);return B.createBytes(n,r)};B.createBytes=function(i,e){for(var t=0,r=0,n=0,s=new Array(e.length),o=new Array(e.length),a=0;a<e.length;a++){var l=e[a].dataCount,c=e[a].totalCount-l;r=Math.max(r,l),n=Math.max(n,c),s[a]=new Array(l);for(var u=0;u<s[a].length;u++)s[a][u]=255&i.buffer[u+t];t+=l;var m=F.getErrorCorrectPolynomial(c),v=new Kr(s[a],m.getLength()-1),g=v.mod(m);o[a]=new Array(m.getLength()-1);for(var d=0;d<o[a].length;d++){var f=d+g.getLength()-o[a].length;o[a][d]=f>=0?g.get(f):0}}for(var y=0,D=0;D<e.length;D++)y+=e[D].totalCount;for(var j=new Array(y),w=0,b=0;b<r;b++)for(var $=0;$<e.length;$++)b<s[$].length&&(j[w++]=s[$][b]);for(var X=0;X<n;X++)for(var Y=0;Y<e.length;Y++)X<o[Y].length&&(j[w++]=o[Y][X]);return j};er.exports=B});var Je=T((_i,nr)=>{h();var Qr=tr(),rr=Ke(),Jr="\x1B[40m \x1B[0m",le="\x1B[47m \x1B[0m",Xr=function(i){return i?Jr:le},Qe=function(i){return{times:function(e){return new Array(e).join(i)}}},Yr=function(i,e){for(var t=new Array(i),r=0;r<i;r++)t[r]=e;return t};nr.exports={error:rr.L,generate:function(i,e,t){typeof e=="function"&&(t=e,e={});var r=new Qr(-1,this.error);r.addData(i),r.make();var n="";if(e&&e.small){var s=!0,o=!1,a=r.getModuleCount(),l=r.modules.slice(),c=a%2===1;c&&l.push(Yr(a,o));var u={WHITE_ALL:"\u2588",WHITE_BLACK:"\u2580",BLACK_WHITE:"\u2584",BLACK_ALL:" "},m=Qe(u.BLACK_WHITE).times(a+3),v=Qe(u.WHITE_BLACK).times(a+3);n+=m+`
|
|
24
|
+
`;for(var g=0;g<a;g+=2){n+=u.WHITE_ALL;for(var d=0;d<a;d++)l[g][d]===o&&l[g+1][d]===o?n+=u.WHITE_ALL:l[g][d]===o&&l[g+1][d]===s?n+=u.WHITE_BLACK:l[g][d]===s&&l[g+1][d]===o?n+=u.BLACK_WHITE:n+=u.BLACK_ALL;n+=u.WHITE_ALL+`
|
|
25
|
+
`}c||(n+=v)}else{var f=Qe(le).times(r.getModuleCount()+3);n+=f+`
|
|
26
|
+
`,r.modules.forEach(function(y){n+=le,n+=y.map(Xr).join(""),n+=le+`
|
|
27
|
+
`}),n+=f}t?t(n):console.log(n)},setErrorLevel:function(i){this.error=rr[i]||this.error}}});h();var J=require("child_process");h();var dt=A(ft(),1),{program:Pn,createCommand:Cn,createArgument:On,createOption:$n,CommanderError:Sn,InvalidArgumentError:Ln,InvalidOptionArgumentError:kn,Command:mt,Argument:Mn,Option:Bn,Help:Dn}=dt.default;var k=A(require("fs"),1),ce=A(require("net"),1);h();var Fe=A(require("node:process"),1),Ve=require("node:buffer"),Ue=A(require("node:path"),1),Bt=require("node:url"),Dt=require("node:util"),We=A(require("node:child_process"),1),ne=A(require("node:fs/promises"),1);h();var Me=A(require("node:process"),1),Q=A(require("node:fs/promises"),1);h();var ke=A(require("node:process"),1),wt=A(require("node:os"),1),vt=A(require("node:fs"),1);h();var pt=A(require("node:fs"),1);h();var $e=A(require("node:fs"),1),Oe;function Lr(){try{return $e.default.statSync("/.dockerenv"),!0}catch{return!1}}function kr(){try{return $e.default.readFileSync("/proc/self/cgroup","utf8").includes("docker")}catch{return!1}}function Se(){return Oe===void 0&&(Oe=Lr()||kr()),Oe}var Le,Mr=()=>{try{return pt.default.statSync("/run/.containerenv"),!0}catch{return!1}};function q(){return Le===void 0&&(Le=Mr()||Se()),Le}var gt=()=>{if(ke.default.platform!=="linux")return!1;if(wt.default.release().toLowerCase().includes("microsoft"))return!q();try{return vt.default.readFileSync("/proc/version","utf8").toLowerCase().includes("microsoft")?!q():!1}catch{return!1}},_=ke.default.env.me?gt:gt();var Br=(()=>{let i="/mnt/",e;return async function(){if(e)return e;let t="/etc/wsl.conf",r=!1;try{await Q.default.access(t,Q.constants.F_OK),r=!0}catch{}if(!r)return i;let n=await Q.default.readFile(t,{encoding:"utf8"}),s=/(?<!#.*)root\s*=\s*(?<mountPoint>.*)/g.exec(n);return s?(e=s.groups.mountPoint.trim(),e=e.endsWith("/")?e:`${e}/`,e):i}})(),Dr=async()=>`${await Br()}c/Windows/System32/WindowsPowerShell/v1.0/powershell.exe`,Be=async()=>_?Dr():`${Me.default.env.SYSTEMROOT||Me.default.env.windir||String.raw`C:\Windows`}\\System32\\WindowsPowerShell\\v1.0\\powershell.exe`;h();function N(i,e,t){let r=n=>Object.defineProperty(i,e,{value:n,enumerable:!0,writable:!0});return Object.defineProperty(i,e,{configurable:!0,enumerable:!0,get(){let n=t();return r(n),n},set(n){r(n)}}),i}h();var Ot=require("node:util"),te=A(require("node:process"),1),$t=require("node:child_process");h();var yt=require("node:util"),At=A(require("node:process"),1),Et=require("node:child_process"),Rr=(0,yt.promisify)(Et.execFile);async function De(){if(At.default.platform!=="darwin")throw new Error("macOS only");let{stdout:i}=await Rr("defaults",["read","com.apple.LaunchServices/com.apple.launchservices.secure","LSHandlers"]);return/LSHandlerRoleAll = "(?!-)(?<id>[^"]+?)";\s+?LSHandlerURLScheme = (?:http|https);/.exec(i)?.groups.id??"com.apple.Safari"}h();h();var bt=A(require("node:process"),1),xt=require("node:util"),Re=require("node:child_process"),Ir=(0,xt.promisify)(Re.execFile);async function Tt(i,{humanReadableOutput:e=!0,signal:t}={}){if(bt.default.platform!=="darwin")throw new Error("macOS only");let r=e?[]:["-ss"],n={};t&&(n.signal=t);let{stdout:s}=await Ir("osascript",["-e",i,r],n);return s.trim()}async function Ie(i){return Tt(`tell application "Finder" to set app_path to application file id "${i}" as string
|
|
28
|
+
tell application "System Events" to get value of property list item "CFBundleName" of property list file (app_path & ":Contents:Info.plist")`)}h();var Pt=require("node:util"),Ct=require("node:child_process"),_r=(0,Pt.promisify)(Ct.execFile),Nr={AppXq0fevzme2pys62n3e0fbqa7peapykr8v:{name:"Edge",id:"com.microsoft.edge.old"},MSEdgeDHTML:{name:"Edge",id:"com.microsoft.edge"},MSEdgeHTM:{name:"Edge",id:"com.microsoft.edge"},"IE.HTTP":{name:"Internet Explorer",id:"com.microsoft.ie"},FirefoxURL:{name:"Firefox",id:"org.mozilla.firefox"},ChromeHTML:{name:"Chrome",id:"com.google.chrome"},BraveHTML:{name:"Brave",id:"com.brave.Browser"},BraveBHTML:{name:"Brave Beta",id:"com.brave.Browser.beta"},BraveSSHTM:{name:"Brave Nightly",id:"com.brave.Browser.nightly"}},ee=class extends Error{};async function _e(i=_r){let{stdout:e}=await i("reg",["QUERY"," HKEY_CURRENT_USER\\Software\\Microsoft\\Windows\\Shell\\Associations\\UrlAssociations\\http\\UserChoice","/v","ProgId"]),t=/ProgId\s*REG_SZ\s*(?<id>\S+)/.exec(e);if(!t)throw new ee(`Cannot find Windows browser in stdout: ${JSON.stringify(e)}`);let{id:r}=t.groups,n=Nr[r];if(!n)throw new ee(`Unknown browser ID: ${r}`);return n}var Hr=(0,Ot.promisify)($t.execFile),Fr=i=>i.toLowerCase().replaceAll(/(?:^|\s|-)\S/g,e=>e.toUpperCase());async function Ne(){if(te.default.platform==="darwin"){let i=await De();return{name:await Ie(i),id:i}}if(te.default.platform==="linux"){let{stdout:i}=await Hr("xdg-mime",["query","default","x-scheme-handler/http"]),e=i.trim();return{name:Fr(e.replace(/.desktop$/,"").replace("-"," ")),id:e}}if(te.default.platform==="win32")return _e();throw new Error("Only macOS, Linux, and Windows are supported")}var Vr=(0,Dt.promisify)(We.default.execFile),He=Ue.default.dirname((0,Bt.fileURLToPath)(p)),St=Ue.default.join(He,"xdg-open"),{platform:G,arch:Lt}=Fe.default;async function Ur(){let i=await Be(),e=String.raw`(Get-ItemProperty -Path "HKCU:\Software\Microsoft\Windows\Shell\Associations\UrlAssociations\http\UserChoice").ProgId`,t=Ve.Buffer.from(e,"utf16le").toString("base64"),{stdout:r}=await Vr(i,["-NoProfile","-NonInteractive","-ExecutionPolicy","Bypass","-EncodedCommand",t],{encoding:"utf8"}),n=r.trim(),s={ChromeHTML:"com.google.chrome",BraveHTML:"com.brave.Browser",MSEdgeHTM:"com.microsoft.edge",FirefoxURL:"org.mozilla.firefox"};return s[n]?{id:s[n]}:{}}var kt=async(i,e)=>{let t;for(let r of i)try{return await e(r)}catch(n){t=n}throw t},re=async i=>{if(i={wait:!1,background:!1,newInstance:!1,allowNonzeroExitCode:!1,...i},Array.isArray(i.app))return kt(i.app,a=>re({...i,app:a}));let{name:e,arguments:t=[]}=i.app??{};if(t=[...t],Array.isArray(e))return kt(e,a=>re({...i,app:{name:a,arguments:t}}));if(e==="browser"||e==="browserPrivate"){let a={"com.google.chrome":"chrome","google-chrome.desktop":"chrome","com.brave.Browser":"brave","org.mozilla.firefox":"firefox","firefox.desktop":"firefox","com.microsoft.msedge":"edge","com.microsoft.edge":"edge","com.microsoft.edgemac":"edge","microsoft-edge.desktop":"edge"},l={chrome:"--incognito",brave:"--incognito",firefox:"--private-window",edge:"--inPrivate"},c=_?await Ur():await Ne();if(c.id in a){let u=a[c.id];return e==="browserPrivate"&&t.push(l[u]),re({...i,app:{name:U[u],arguments:t}})}throw new Error(`${c.name} is not supported as a default browser`)}let r,n=[],s={};if(G==="darwin")r="open",i.wait&&n.push("--wait-apps"),i.background&&n.push("--background"),i.newInstance&&n.push("--new"),e&&n.push("-a",e);else if(G==="win32"||_&&!q()&&!e){r=await Be(),n.push("-NoProfile","-NonInteractive","-ExecutionPolicy","Bypass","-EncodedCommand"),_||(s.windowsVerbatimArguments=!0);let a=["Start"];i.wait&&a.push("-Wait"),e?(a.push(`"\`"${e}\`""`),i.target&&t.push(i.target)):i.target&&a.push(`"${i.target}"`),t.length>0&&(t=t.map(l=>`"\`"${l}\`""`),a.push("-ArgumentList",t.join(","))),i.target=Ve.Buffer.from(a.join(" "),"utf16le").toString("base64")}else{if(e)r=e;else{let a=!He||He==="/",l=!1;try{await ne.default.access(St,ne.constants.X_OK),l=!0}catch{}r=Fe.default.versions.electron??(G==="android"||a||!l)?"xdg-open":St}t.length>0&&n.push(...t),i.wait||(s.stdio="ignore",s.detached=!0)}G==="darwin"&&t.length>0&&n.push("--args",...t),i.target&&n.push(i.target);let o=We.default.spawn(r,n,s);return i.wait?new Promise((a,l)=>{o.once("error",l),o.once("close",c=>{if(!i.allowNonzeroExitCode&&c>0){l(new Error(`Exited with code ${c}`));return}a(o)})}):(o.unref(),o)},Wr=(i,e)=>{if(typeof i!="string")throw new TypeError("Expected a `target`");return re({...e,target:i})};function Mt(i){if(typeof i=="string"||Array.isArray(i))return i;let{[Lt]:e}=i;if(!e)throw new Error(`${Lt} is not supported`);return e}function ie({[G]:i},{wsl:e}){if(e&&_)return Mt(e);if(!i)throw new Error(`${G} is not supported`);return Mt(i)}var U={};N(U,"chrome",()=>ie({darwin:"google chrome",win32:"chrome",linux:["google-chrome","google-chrome-stable","chromium"]},{wsl:{ia32:"/mnt/c/Program Files (x86)/Google/Chrome/Application/chrome.exe",x64:["/mnt/c/Program Files/Google/Chrome/Application/chrome.exe","/mnt/c/Program Files (x86)/Google/Chrome/Application/chrome.exe"]}}));N(U,"brave",()=>ie({darwin:"brave browser",win32:"brave",linux:["brave-browser","brave"]},{wsl:{ia32:"/mnt/c/Program Files (x86)/BraveSoftware/Brave-Browser/Application/brave.exe",x64:["/mnt/c/Program Files/BraveSoftware/Brave-Browser/Application/brave.exe","/mnt/c/Program Files (x86)/BraveSoftware/Brave-Browser/Application/brave.exe"]}}));N(U,"firefox",()=>ie({darwin:"firefox",win32:String.raw`C:\Program Files\Mozilla Firefox\firefox.exe`,linux:"firefox"},{wsl:"/mnt/c/Program Files/Mozilla Firefox/firefox.exe"}));N(U,"edge",()=>ie({darwin:"microsoft edge",win32:"msedge",linux:["microsoft-edge","microsoft-edge-dev"]},{wsl:"/mnt/c/Program Files (x86)/Microsoft/Edge/Application/msedge.exe"}));N(U,"browser",()=>"browser");N(U,"browserPrivate",()=>"browserPrivate");var se=Wr;var he=A(require("os"),1),I=A(require("path"),1),ue=process.env.POKE_API??"https://poke.com/api/v1",zr=process.env.POKE_FRONTEND??"https://poke.com",Zr=`
|
|
29
29
|
@@@@@@@ @@@@@@@@
|
|
30
30
|
@@@@@@@@@@@@ @@@@@@@@@@@@@
|
|
31
31
|
@@@@@@@@@@ @@@@@@@@@@
|
|
@@ -51,12 +51,12 @@ tell application "System Events" to get value of property list item "CFBundleNam
|
|
|
51
51
|
@@@@
|
|
52
52
|
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
|
|
53
53
|
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
|
|
54
|
-
`;function
|
|
55
|
-
`);let e=await fetch(`${ue}/cli-auth/code`,{method:"POST"});e.ok||(console.error("Failed to create login code"),process.exit(1));let{deviceCode:t,userCode:r}=await e.json(),n=`${
|
|
54
|
+
`;function sr(){let i=process.env.XDG_CONFIG_HOME;return i?I.default.join(i,"poke"):I.default.join(he.default.homedir(),".config","poke")}function Xe(){return I.default.join(sr(),"credentials.json")}function en(i){let e=sr(),t=Xe();k.default.mkdirSync(e,{recursive:!0});let r={token:i};k.default.writeFileSync(t,JSON.stringify(r,null,2));try{k.default.chmodSync(t,384)}catch{}}function Ye(){try{let i=k.default.readFileSync(Xe(),"utf-8");return JSON.parse(i)}catch{return null}}function or(){try{k.default.unlinkSync(Xe())}catch{}}async function L(i,e={}){let t=Ye();t?.token||(console.error("Not logged in. Run 'poke login'."),process.exit(1));let r=new Headers(e.headers);r.set("Authorization",`Bearer ${t.token}`);let n=await fetch(`${ue}${i}`,{...e,headers:r});return n.status===401&&(or(),console.error("Session expired. Run 'poke login' again."),process.exit(1)),n}function ze(i){return new Promise(e=>setTimeout(e,i))}async function tn(){if(Ye()?.token){console.log("Already logged in. Run 'poke logout' first to switch accounts.");return}console.log(Zr),console.log(`Starting login...
|
|
55
|
+
`);let e=await fetch(`${ue}/cli-auth/code`,{method:"POST"});e.ok||(console.error("Failed to create login code"),process.exit(1));let{deviceCode:t,userCode:r}=await e.json(),n=`${zr}/device`;console.log(`Your login code is:
|
|
56
56
|
`),console.log(` ${r}
|
|
57
57
|
`),console.log(`Opening ${n} ...
|
|
58
58
|
`),console.log(`Enter the code above in your browser to log in.
|
|
59
|
-
`),console.log("Waiting for authentication...");try{await
|
|
59
|
+
`),console.log("Waiting for authentication...");try{await se(n)}catch{}let s=5*60*1e3,o=2e3,a=Date.now()+s;for(;Date.now()<a;){await ze(o);let c=await(await fetch(`${ue}/cli-auth/poll/${t}`)).json();if(c.status==="authenticated"){en(c.token),console.log(`
|
|
60
60
|
\u2713 Logged in successfully!
|
|
61
61
|
`);return}c.status==="expired"&&(console.error(`
|
|
62
62
|
Code expired. Run 'poke login' again.
|
|
@@ -64,40 +64,43 @@ Code expired. Run 'poke login' again.
|
|
|
64
64
|
Invalid code. Run 'poke login' again.
|
|
65
65
|
`),process.exit(1)),process.stdout.write(".")}console.error(`
|
|
66
66
|
Login timed out. Run 'poke login' again.
|
|
67
|
-
`),process.exit(1)}async function
|
|
67
|
+
`),process.exit(1)}async function rn(){or(),console.log("Logged out.")}async function nn(){let i=await L("/user/profile");i.ok||(console.error("Failed to fetch profile"),process.exit(1));let e=await i.json();console.log(e.name??e.email??e.id??"Logged in")}var V=new mt;V.name("poke").description("Poke CLI - Create tunnels to expose local servers").version("0.1.0");V.command("login").description("Log in to Poke").action(tn);V.command("logout").description("Log out").action(rn);V.command("whoami").description("Show current user").action(nn);var ir="0.7.0";function sn(){let i=process.env.XDG_CACHE_HOME;return i?I.default.join(i,"poke","bin"):I.default.join(he.default.homedir(),".cache","poke","bin")}async function ar(){let i=sn(),e=I.default.join(i,`piko-${ir}`);if(k.default.existsSync(e))return e;if(k.default.mkdirSync(i,{recursive:!0}),process.platform==="win32")throw new Error("Windows is not supported yet. Use WSL instead.");let t=process.platform==="darwin"?"darwin":"linux",r=process.arch==="arm64"?"arm64":"amd64",n=`https://github.com/andydunstall/piko/releases/download/v${ir}/piko-${t}-${r}`;console.log("Downloading tunnel agent...");let s=await fetch(n,{redirect:"follow"});if(!s.ok)throw new Error(`Failed to download tunnel agent: ${s.status}`);let o=await s.arrayBuffer();return k.default.writeFileSync(e,Buffer.from(o)),k.default.chmodSync(e,493),e}var on=V.command("mcp").description("Manage MCP server connections");on.command("add").description("Add an MCP server connection").argument("<url>","MCP server URL").requiredOption("-n, --name <name>","Display name for the connection").option("-k, --api-key <key>","API key if the server requires one").action(async(i,e)=>{let t={name:e.name,serverUrl:i};e.apiKey&&(t.apiKey=e.apiKey);let r=await L("/mcp/connections/cli",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(t)});if(!r.ok){let o=await r.text(),a={};try{a=JSON.parse(o)}catch{}a.error==="OAUTH_REQUIRED"&&(console.error(`
|
|
68
68
|
This MCP server requires OAuth authentication.`),console.error(`Add it from the web app instead.
|
|
69
69
|
`),process.exit(1)),console.error(`
|
|
70
|
-
Failed to add MCP connection: ${
|
|
70
|
+
Failed to add MCP connection: ${a.message??`HTTP ${r.status}`}
|
|
71
71
|
`),process.exit(1)}let n=await r.json(),s=Array.isArray(n.tools)?n.tools.length:0;console.log(`
|
|
72
72
|
MCP connection added successfully!`),console.log(` Name: ${n.name}`),console.log(` Server URL: ${n.serverUrl}`),console.log(` Tools: ${s}
|
|
73
|
-
`)});
|
|
73
|
+
`)});V.command("tunnel").description("Create a tunnel to expose a local MCP server").argument("<url>","Local MCP server URL (e.g. http://localhost:3000/mcp)").requiredOption("-n, --name <name>","Display name for the connection").action(async(i,e)=>{let t;try{t=new URL(i)}catch{console.error(`
|
|
74
74
|
Invalid URL: ${i}
|
|
75
|
-
`),process.exit(1)}let r=
|
|
76
|
-
Failed to create tunnel: ${
|
|
77
|
-
`),process.exit(1)}let
|
|
75
|
+
`),process.exit(1)}let r=await L("/mcp/connections/cli",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({name:e.name,serverUrl:i,tunnel:!0})});if(!r.ok){let f=await r.text(),y=`HTTP ${r.status}`;try{y=JSON.parse(f).message??y}catch{}console.error(`
|
|
76
|
+
Failed to create tunnel: ${y}
|
|
77
|
+
`),process.exit(1)}let n=await r.json();(!n.tunnel?.token||!n.tunnel?.upstreamUrl)&&(console.error(`
|
|
78
78
|
Tunnel configuration not available.
|
|
79
|
-
`),process.exit(1));let
|
|
80
|
-
Failed to download tunnel agent: ${
|
|
81
|
-
`),process.exit(1)}let
|
|
82
|
-
Failed to start tunnel agent: ${
|
|
83
|
-
`),process.exit(1)}),a.stderr?.on("data",
|
|
79
|
+
`),process.exit(1));let s;try{s=await ar()}catch(f){console.error(`
|
|
80
|
+
Failed to download tunnel agent: ${f instanceof Error?f.message:f}
|
|
81
|
+
`),process.exit(1)}let o=t.host,a=(0,J.spawn)(s,["agent","http",n.id,o,"--connect.url",n.tunnel.upstreamUrl,"--connect.token",n.tunnel.token]);a.on("error",f=>{console.error(`
|
|
82
|
+
Failed to start tunnel agent: ${f.message}
|
|
83
|
+
`),process.exit(1)}),a.stderr?.on("data",f=>{let y=f.toString().trim();y&&console.error(y)}),await ze(2e3),a.exitCode!==null&&(console.error(`
|
|
84
84
|
Tunnel agent failed to start (exit ${a.exitCode}).
|
|
85
85
|
`),process.exit(1)),console.log(`
|
|
86
86
|
Tunnel is active!
|
|
87
|
-
`),console.log(` Tunnel URL: ${
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
`)
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
`)}
|
|
94
|
-
`)
|
|
95
|
-
|
|
96
|
-
`)
|
|
87
|
+
`),console.log(` Tunnel URL: ${n.serverUrl}`),console.log(` Local: ${i}`),console.log(` Name: ${n.name}`);let l=async()=>{try{let f=await L(`/mcp/connections/${n.id}/sync-tools`,{method:"POST"});f.ok?console.log(`[${new Date().toLocaleTimeString()}] Tools synced.`):console.error(`[${new Date().toLocaleTimeString()}] Tool sync failed (HTTP ${f.status}).`)}catch{console.error(`[${new Date().toLocaleTimeString()}] Tool sync failed.`)}},c=await L(`/mcp/connections/${n.id}/activate-tunnel`,{method:"POST"});if(c.ok){let f=await c.json();if(f.status==="authenticated")console.log(`[${new Date().toLocaleTimeString()}] Connection activated and tools synced.`);else if(f.status==="oauth_required"){console.log(`
|
|
88
|
+
This MCP server requires OAuth authentication.
|
|
89
|
+
Opening browser...
|
|
90
|
+
`);try{await se(f.authUrl)}catch{}}}else console.error(`[${new Date().toLocaleTimeString()}] Activation failed (HTTP ${c.status}). Falling back to periodic sync.`),await l();let u=await L(`/mcp/connections/${n.id}/create-recipe`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({name:e.name})});if(u.ok){let f=await u.json();console.log(`
|
|
91
|
+
Recipe: ${f.link}
|
|
92
|
+
`),console.log(`Share this recipe link so others can use your tunnel:
|
|
93
|
+
`),(await Promise.resolve().then(()=>A(Je(),1))).generate(f.link,{small:!0},D=>{console.log(D)})}else{let f=await u.text();console.error(`[${new Date().toLocaleTimeString()}] Failed to create recipe (HTTP ${u.status}): ${f}`)}console.log(`Press Ctrl+C to stop the tunnel.
|
|
94
|
+
`);let m=setInterval(l,5*60*1e3),v=!1,g=async()=>{if(!v){v=!0,clearInterval(m),console.log(`
|
|
95
|
+
Removing MCP connection...`);try{await L(`/mcp/connections/${n.id}`,{method:"DELETE"}),console.log(`MCP connection removed.
|
|
96
|
+
`)}catch{console.error(`Failed to remove MCP connection.
|
|
97
|
+
`)}a.exitCode===null&&a.kill(),process.exit(0)}};process.on("SIGINT",g),process.on("SIGTERM",g);let d=await new Promise(f=>{a.on("exit",y=>{console.log(`
|
|
98
|
+
Tunnel stopped${y?` (exit ${y})`:""}.
|
|
99
|
+
`),f(y??0)})});v||process.exit(d)});function an(i){return new Promise((e,t)=>{let r=ce.default.createServer();r.listen(i,()=>{let{port:n}=r.address();r.close(()=>e(n))}),r.on("error",()=>{let n=ce.default.createServer();n.listen(0,()=>{let{port:s}=n.address();n.close(()=>e(s))}),n.on("error",t)})})}function ln(i,e){let t=Date.now()+e;return new Promise((r,n)=>{let s=()=>{if(Date.now()>t){n(new Error(`Server did not start within ${e}ms`));return}let o=ce.default.createConnection({port:i,host:"127.0.0.1"},()=>{o.destroy(),r()});o.on("error",()=>{setTimeout(s,500)})};s()})}V.command("wrap").description("Wrap the current project in an MCP server using AI").option("--port <port>","Port for the MCP server","8765").option("-n, --name <name>","Display name for the connection").option("--share","Create a shareable recipe with QR code").action(async i=>{let e=Ye();e?.token||(console.error("Not logged in. Run 'poke login'."),process.exit(1)),(0,J.spawnSync)("uv",["--version"],{stdio:"ignore"}).status!==0&&(console.error(`uv is required but not installed.
|
|
97
100
|
|
|
98
101
|
Install it with:
|
|
99
102
|
curl -LsSf https://astral.sh/uv/install.sh | sh
|
|
100
|
-
`),process.exit(1));let r=process.cwd(),n=await
|
|
103
|
+
`),process.exit(1));let r=process.cwd(),n=await an(parseInt(i.port,10)),s=I.default.join(he.default.tmpdir(),"poke-wrap",`wrap-${Date.now()}`);k.default.mkdirSync(s,{recursive:!0});let o=`You are generating an MCP server that wraps the functionality of the software project in the current directory.
|
|
101
104
|
|
|
102
105
|
## Your Task
|
|
103
106
|
|
|
@@ -158,28 +161,31 @@ Install it with:
|
|
|
158
161
|
- Include proper error handling in every tool
|
|
159
162
|
- Tools should work with the project as-is
|
|
160
163
|
- You MUST install deps and start the server using the Bash tool before finishing`;console.log(`Analyzing project and generating MCP server...
|
|
161
|
-
`);try{let{query:
|
|
162
|
-
Failed to generate MCP server:`,$.errors??"unknown error"),process.exit(1))}}}catch(
|
|
163
|
-
Failed to run AI agent: ${
|
|
164
|
-
`);try{await
|
|
165
|
-
`);let
|
|
166
|
-
Failed to create tunnel: ${
|
|
167
|
-
`),process.exit(1)}let
|
|
164
|
+
`);try{let{query:w}=await import("@anthropic-ai/claude-agent-sdk");for await(let b of w({prompt:o,options:{cwd:r,allowedTools:["Read","Write","Bash","Glob","Grep"],permissionMode:"bypassPermissions",allowDangerouslySkipPermissions:!0,maxTurns:30,env:{...process.env,ANTHROPIC_BASE_URL:`${ue}/ai-proxy`,ANTHROPIC_API_KEY:e.token}}})){if(b.type==="assistant")for(let $ of b.message.content)$.type==="text"&&$.text&&process.stdout.write($.text);if(b.type==="result"){let $=b;$.subtype!=="success"&&(console.error(`
|
|
165
|
+
Failed to generate MCP server:`,$.errors??"unknown error"),process.exit(1))}}}catch(w){console.error(`
|
|
166
|
+
Failed to run AI agent: ${w instanceof Error?w.message:w}`),console.error("Make sure @anthropic-ai/claude-agent-sdk is installed."),process.exit(1)}console.log(`
|
|
167
|
+
`);try{await ln(n,1e4)}catch{console.error("MCP server is not running. The agent may have failed to start it."),process.exit(1)}console.log(`MCP server is running on port ${n}!
|
|
168
|
+
`);let a=`http://localhost:${n}/mcp`,l=i.name??`wrap-${I.default.basename(r)}`,c=await L("/mcp/connections/cli",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({name:l,serverUrl:a,tunnel:!0,share:i.share??!1})});if(!c.ok){let w=await c.text(),b=`HTTP ${c.status}`;try{b=JSON.parse(w).message??b}catch{}console.error(`
|
|
169
|
+
Failed to create tunnel: ${b}
|
|
170
|
+
`),process.exit(1)}let u=await c.json();(!u.tunnel?.token||!u.tunnel?.upstreamUrl)&&(console.error(`
|
|
168
171
|
Tunnel configuration not available.
|
|
169
|
-
`),process.exit(1));let
|
|
170
|
-
Failed to download tunnel agent: ${
|
|
171
|
-
`),process.exit(1)}let
|
|
172
|
-
Failed to start tunnel agent: ${
|
|
173
|
-
`),process.exit(1)}),
|
|
174
|
-
Tunnel agent failed to start (exit ${
|
|
172
|
+
`),process.exit(1));let m;try{m=await ar()}catch(w){console.error(`
|
|
173
|
+
Failed to download tunnel agent: ${w instanceof Error?w.message:w}
|
|
174
|
+
`),process.exit(1)}let v=new URL(a).host,g=(0,J.spawn)(m,["agent","http",u.id,v,"--connect.url",u.tunnel.upstreamUrl,"--connect.token",u.tunnel.token]);g.on("error",w=>{console.error(`
|
|
175
|
+
Failed to start tunnel agent: ${w.message}
|
|
176
|
+
`),process.exit(1)}),g.stderr?.on("data",w=>{let b=w.toString().trim();b&&console.error(b)}),await ze(2e3),g.exitCode!==null&&(console.error(`
|
|
177
|
+
Tunnel agent failed to start (exit ${g.exitCode}).
|
|
175
178
|
`),process.exit(1)),console.log(`Tunnel is active!
|
|
176
|
-
`),console.log(` Tunnel URL: ${
|
|
177
|
-
`),
|
|
178
|
-
`),console.log(` ${
|
|
179
|
-
`),(await Promise.resolve().then(()=>
|
|
180
|
-
`);let
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
`)
|
|
184
|
-
|
|
185
|
-
`)
|
|
179
|
+
`),console.log(` Tunnel URL: ${u.serverUrl}`),console.log(` Local: ${a}`),console.log(` Name: ${l}
|
|
180
|
+
`),u.recipe?.link&&(console.log(`Share this with others:
|
|
181
|
+
`),console.log(` ${u.recipe.link}
|
|
182
|
+
`),(await Promise.resolve().then(()=>A(Je(),1))).generate(u.recipe.link,{small:!0},b=>{console.log(b)})),console.log(`Press Ctrl+C to stop.
|
|
183
|
+
`);let d=async()=>{try{let w=await L(`/mcp/connections/${u.id}/sync-tools`,{method:"POST"});w.ok?console.log(`[${new Date().toLocaleTimeString()}] Tools synced.`):console.error(`[${new Date().toLocaleTimeString()}] Tool sync failed (HTTP ${w.status}).`)}catch{console.error(`[${new Date().toLocaleTimeString()}] Tool sync failed.`)}},f=await L(`/mcp/connections/${u.id}/activate-tunnel`,{method:"POST"});if(f.ok){let w=await f.json();if(w.status==="authenticated")console.log(`[${new Date().toLocaleTimeString()}] Connection activated and tools synced.`);else if(w.status==="oauth_required"){console.log(`
|
|
184
|
+
This MCP server requires OAuth authentication.
|
|
185
|
+
Opening browser...
|
|
186
|
+
`);try{await se(w.authUrl)}catch{}}}else console.error(`[${new Date().toLocaleTimeString()}] Activation failed (HTTP ${f.status}). Falling back to periodic sync.`),await d();let y=setInterval(d,5*60*1e3),D=!1,j=async()=>{if(!D){D=!0,clearInterval(y),console.log(`
|
|
187
|
+
Removing MCP connection...`);try{await L(`/mcp/connections/${u.id}`,{method:"DELETE"}),console.log(`MCP connection removed.
|
|
188
|
+
`)}catch{console.error(`Failed to remove MCP connection.
|
|
189
|
+
`)}g.exitCode===null&&g.kill(),process.exit(0)}};process.on("SIGINT",j),process.on("SIGTERM",j),await new Promise(w=>{g.on("exit",b=>{console.log(`
|
|
190
|
+
Tunnel stopped${b?` (exit ${b})`:""}.
|
|
191
|
+
`),w()})}),D||process.exit(0)});V.parse();
|