poke 0.2.1 → 0.2.3
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 +72 -71
- 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
|
|
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
|
|
2
|
+
"use strict";var dr=Object.create;var it=Object.defineProperty;var mr=Object.getOwnPropertyDescriptor;var pr=Object.getOwnPropertyNames;var gr=Object.getPrototypeOf,wr=Object.prototype.hasOwnProperty;var vr=(i,e)=>()=>(i&&(e=i(i=0)),e);var P=(i,e)=>()=>(e||i((e={exports:{}}).exports,e),e.exports);var yr=(i,e,t,r)=>{if(e&&typeof e=="object"||typeof e=="function")for(let n of pr(e))!wr.call(i,n)&&n!==t&&it(i,n,{get:()=>e[n],enumerable:!(r=mr(e,n))||r.enumerable});return i};var A=(i,e,t)=>(t=i!=null?dr(gr(i)):{},yr(e||!i||!i.__esModule?it(t,"default",{value:i,enumerable:!0}):t,i));var st,g,h=vr(()=>{"use strict";st=require("url"),g=(0,st.pathToFileURL)(__filename).href});var z=P(ve=>{h();var te=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}},we=class extends te{constructor(e){super(1,"commander.invalidArgument",e),Error.captureStackTrace(this,this.constructor),this.name=this.constructor.name}};ve.CommanderError=te;ve.InvalidArgumentError=we});var re=P(Ae=>{h();var{InvalidArgumentError:Ar}=z(),ye=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 Ar(`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 Er(i){let e=i.name()+(i.variadic===!0?"...":"");return i.required?"<"+e+">":"["+e+"]"}Ae.Argument=ye;Ae.humanReadableArgName=Er});var be=P(ot=>{h();var{humanReadableArgName:br}=re(),Ee=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=>br(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,T){if(T){let $=`${d.padEnd(r+o)}${T}`;return t.wrap($,n-s,r+o)}return d}function c(d){return d.join(`
|
|
3
|
+
`).replace(/^/gm," ".repeat(s))}let l=[`Usage: ${t.commandUsage(e)}`,""],u=t.commandDescription(e);u.length>0&&(l=l.concat([t.wrap(u,n,0),""]));let f=t.visibleArguments(e).map(d=>a(t.argumentTerm(d),t.argumentDescription(d)));f.length>0&&(l=l.concat(["Arguments:",c(f),""]));let w=t.visibleOptions(e).map(d=>a(t.optionTerm(d),t.optionDescription(d)));if(w.length>0&&(l=l.concat(["Options:",c(w),""])),this.showGlobalOptions){let d=t.visibleGlobalOptions(e).map(T=>a(t.optionTerm(T),t.optionDescription(T)));d.length>0&&(l=l.concat(["Global Options:",c(d),""]))}let v=t.visibleCommands(e).map(d=>a(t.subcommandTerm(d),t.subcommandDescription(d)));return v.length>0&&(l=l.concat(["Commands:",c(v),""])),l.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 c=e.slice(0,r),l=e.slice(r).replace(`\r
|
|
5
5
|
`,`
|
|
6
|
-
`),u=" ".repeat(r),
|
|
7
|
-
|.{1,${a-1}}([${
|
|
8
|
-
`?"":(
|
|
9
|
-
`)}};
|
|
6
|
+
`),u=" ".repeat(r),w="\\s\u200B",v=new RegExp(`
|
|
7
|
+
|.{1,${a-1}}([${w}]|$)|[^${w}]+?([${w}]|$)`,"g"),d=l.match(v)||[];return c+d.map((T,$)=>T===`
|
|
8
|
+
`?"":($>0?u:"")+T.trimEnd()).join(`
|
|
9
|
+
`)}};ot.Help=Ee});var Ce=P(Pe=>{h();var{InvalidArgumentError:Tr}=z(),Te=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=Pr(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 Tr(`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 xr(this.name().replace(/^no-/,""))}is(e){return this.short===e||this.long===e}isBoolean(){return!this.required&&!this.optional&&!this.negate}},xe=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 xr(i){return i.split("-").reduce((e,t)=>e+t[0].toUpperCase()+t.slice(1))}function Pr(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}}Pe.Option=Te;Pe.DualOptions=xe});var ct=P(at=>{h();function Cr(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 Or(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=Cr(i,o),c=Math.max(i.length,o.length);(c-a)/c>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]}?)`:""}
|
|
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.
|
|
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
|
|
11
|
+
(Did you mean ${r[0]}?)`:""}at.suggestSimilar=Or});var dt=P(ft=>{h();var $r=require("node:events").EventEmitter,Oe=require("node:child_process"),F=require("node:path"),$e=require("node:fs"),E=require("node:process"),{Argument:Sr,humanReadableArgName:Lr}=re(),{CommanderError:Se}=z(),{Help:kr}=be(),{Option:lt,DualOptions:Mr}=Ce(),{suggestSimilar:ut}=ct(),Le=class i extends $r{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.T={},this.F={},this.a=!1,this.w=null,this.x=!1,this.R=null,this.I=null,this.f=null,this.c=null,this.o=[],this.P=!0,this.U="",this.V="",this.D=void 0,this.d=!1,this.C=!1,this.l={},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.c=e.c,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(/([^ ]+) *(.*)/),c=this.createCommand(o);return n&&(c.description(n),c.x=!0),s.isDefault&&(this.f=c.e),c.E=!!(s.noHelp||s.hidden),c.R=s.executableFile||null,a&&c.arguments(a),this.W(c),c.parent=this,c.copyInheritedSettings(this),n?this:c}createCommand(e){return new i(e)}createHelp(){return Object.assign(new kr,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 Sr(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.l[e]?this.l[e].push(t):this.l[e]=[t],this}exitOverride(e){return e?this.c=e:this.c=t=>{if(t.code!=="commander.executeSubCommandAsync")throw t},this}S(e,t,r){this.c&&this.c(new Se(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 lt(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 c=this.getOptionValue(r);s!==null&&e.parseArg?s=this.q(e,s,c,o):s!==null&&e.variadic&&(s=e.A(s,c)),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 lt)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=(c,l)=>{let u=a.exec(c);return u?u[0]:l},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.T).length)throw new Error("call .storeOptionsAsProperties() before setting option values");return this.a=!!e,this}getOptionValue(e){return this.a?this[e]:this.T[e]}setOptionValue(e,t){return this.setOptionValueWithSource(e,t,void 0)}setOptionValueWithSource(e,t,r){return this.a?this[e]=t:this.T[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,f){let w=F.resolve(u,f);if($e.existsSync(w))return w;if(n.includes(F.extname(f)))return;let v=n.find(d=>$e.existsSync(`${w}${d}`));if(v)return`${w}${v}`}this.X(),this.Y();let o=e.R||`${this.e}-${e.e}`,a=this.I||"";if(this.r){let u;try{u=$e.realpathSync(this.r)}catch{u=this.r}a=F.resolve(F.dirname(u),a)}if(a){let u=s(a,o);if(!u&&!e.R&&this.r){let f=F.basename(this.r,F.extname(this.r));f!==this.e&&(u=s(a,`${f}-${e.e}`))}o=u||o}r=n.includes(F.extname(o));let c;E.platform!=="win32"?r?(t.unshift(o),t=ht(E.execArgv).concat(t),c=Oe.spawn(E.argv[0],t,{stdio:"inherit"})):c=Oe.spawn(o,t,{stdio:"inherit"}):(t.unshift(o),t=ht(E.execArgv).concat(t),c=Oe.spawn(E.execPath,t,{stdio:"inherit"})),c.killed||["SIGUSR1","SIGUSR2","SIGTERM","SIGINT","SIGHUP"].forEach(f=>{E.on(f,()=>{c.killed===!1&&c.exitCode===null&&c.kill(f)})});let l=this.c;c.on("close",u=>{u=u??1,l?l(new Se(u,"commander.executeSubCommandAsync","(close)")):E.exit(u)}),c.on("error",u=>{if(u.code==="ENOENT"){let f=a?`searched for local subcommand relative to directory '${a}'`:"no directory for search for local subcommand, use .executableDir() to supply a custom directory",w=`'${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
|
+
- ${f}`;throw new Error(w)}else if(u.code==="EACCES")throw new Error(`'${o}' not executable`);if(!l)E.exit(1);else{let f=new Se(1,"commander.executeSubCommandAsync","(error)");f.nestedError=u,l(f)}}),this.runningCommand=c}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.x)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.x&&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.l[t]!==void 0).forEach(s=>{s.l[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.l[r]!==void 0&&this.l[r].forEach(s=>{n=this.y(n,()=>s(this,t))}),n}_(e,t){let r=this.parseOptions(t);if(this.ae(),this.ce(),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)})})}le(){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.le()})}parseOptions(e){let t=[],r=[],n=t,s=e.slice();function o(c){return c.length>1&&c[0]==="-"}let a=null;for(;s.length;){let c=s.shift();if(c==="--"){n===r&&n.push(c),n.push(...s);break}if(a&&!o(c)){this.emit(`option:${a.name()}`,c);continue}if(a=null,o(c)){let l=this.i(c);if(l){if(l.required){let u=s.shift();u===void 0&&this.optionMissingArgument(l),this.emit(`option:${l.name()}`,u)}else if(l.optional){let u=null;s.length>0&&!o(s[0])&&(u=s.shift()),this.emit(`option:${l.name()}`,u)}else this.emit(`option:${l.name()}`);a=l.variadic?l:null;continue}}if(c.length>2&&c[0]==="-"&&c[1]!=="-"){let l=this.i(`-${c[1]}`);if(l){l.required||l.optional&&this.P?this.emit(`option:${l.name()}`,c.slice(2)):(this.emit(`option:${l.name()}`),s.unshift(`-${c.slice(2)}`));continue}}if(/^--[^=]+=/.test(c)){let l=c.indexOf("="),u=this.i(c.slice(0,l));if(u&&(u.required||u.optional)){this.emit(`option:${u.name()}`,c.slice(l+1));continue}}if(o(c)&&(n=r),(this.d||this.C)&&t.length===0&&r.length===0){if(this.s(c)){t.push(c),s.length>0&&r.push(...s);break}else if(this.g()&&c===this.g().name()){t.push(c),s.length>0&&t.push(...s);break}else if(this.f){r.push(c),s.length>0&&r.push(...s);break}}if(this.C){n.push(c),s.length>0&&n.push(...s);break}n.push(c)}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.T}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 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()}`))}})}
|
|
21
|
-
`),this.S(0,"commander.version",e)}),this}description(e,t){return e===void 0&&t===void 0?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()}`))}})}ce(){let e=new Mr(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(),c=this.getOptionValue(a),l=this.options.find(f=>f.negate&&a===f.attributeName()),u=this.options.find(f=>!f.negate&&a===f.attributeName());return l&&(l.presetArg===void 0&&c===!1||l.presetArg!==void 0&&c===l.presetArg)?l:u||o},n=o=>{let a=r(o),c=a.attributeName();return this.getOptionValueSource(c)==="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=ut(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=ut(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.U:(this.U=e,t&&(this.D=t),this)}summary(e){return e===void 0?this.V:(this.V=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].x&&(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=>Lr(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=F.basename(e,F.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=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
|
|
25
|
-
`}
|
|
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 ht(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})}ft.Command=Le});var wt=P(S=>{h();var{Argument:mt}=re(),{Command:ke}=dt(),{CommanderError:Br,InvalidArgumentError:pt}=z(),{Help:Dr}=be(),{Option:gt}=Ce();S.program=new ke;S.createCommand=i=>new ke(i);S.createOption=(i,e)=>new gt(i,e);S.createArgument=(i,e)=>new mt(i,e);S.Command=ke;S.Option=gt;S.Argument=mt;S.Help=Dr;S.CommanderError=Br;S.InvalidArgumentError=pt;S.InvalidOptionArgumentError=pt});var Je=P((Ai,Ht)=>{h();Ht.exports={MODE_NUMBER:1,MODE_ALPHA_NUM:2,MODE_8BIT_BYTE:4,MODE_KANJI:8}});var Wt=P((bi,Vt)=>{h();var Jr=Je();function Ut(i){this.mode=Jr.MODE_8BIT_BYTE,this.data=i}Ut.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)}};Vt.exports=Ut});var Xe=P((xi,jt)=>{h();var M={glog:function(i){if(i<1)throw new Error("glog("+i+")");return M.LOG_TABLE[i]},gexp:function(i){for(;i<0;)i+=255;for(;i>=256;)i-=255;return M.EXP_TABLE[i]},EXP_TABLE:new Array(256),LOG_TABLE:new Array(256)};for(x=0;x<8;x++)M.EXP_TABLE[x]=1<<x;var x;for(x=8;x<256;x++)M.EXP_TABLE[x]=M.EXP_TABLE[x-4]^M.EXP_TABLE[x-5]^M.EXP_TABLE[x-6]^M.EXP_TABLE[x-8];var x;for(x=0;x<255;x++)M.LOG_TABLE[M.EXP_TABLE[x]]=x;var x;jt.exports=M});var Ye=P((Ci,qt)=>{h();var Q=Xe();function le(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]}le.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]^=Q.gexp(Q.glog(this.get(t))+Q.glog(i.get(r)));return new le(e,0)},mod:function(i){if(this.getLength()-i.getLength()<0)return this;for(var e=Q.glog(this.get(0))-Q.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]^=Q.gexp(Q.glog(i.get(n))+e);return new le(t,0).mod(i)}};qt.exports=le});var Kt=P(($i,Gt)=>{h();Gt.exports={PATTERN000:0,PATTERN001:1,PATTERN010:2,PATTERN011:3,PATTERN100:4,PATTERN101:5,PATTERN110:6,PATTERN111:7}});var Xt=P((Li,Jt)=>{h();var L=Je(),Qt=Ye(),Xr=Xe(),W=Kt(),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 W.PATTERN000:return(e+t)%2===0;case W.PATTERN001:return e%2===0;case W.PATTERN010:return t%3===0;case W.PATTERN011:return(e+t)%3===0;case W.PATTERN100:return(Math.floor(e/2)+Math.floor(t/3))%2===0;case W.PATTERN101:return e*t%2+e*t%3===0;case W.PATTERN110:return(e*t%2+e*t%3)%2===0;case W.PATTERN111:return(e*t%3+(e+t)%2)%2===0;default:throw new Error("bad maskPattern:"+i)}},getErrorCorrectPolynomial:function(i){for(var e=new Qt([1],0),t=0;t<i;t++)e=e.multiply(new Qt([1,Xr.gexp(t)],0));return e},getLengthInBits:function(i,e){if(1<=e&&e<10)switch(i){case L.MODE_NUMBER:return 10;case L.MODE_ALPHA_NUM:return 9;case L.MODE_8BIT_BYTE:return 8;case L.MODE_KANJI:return 8;default:throw new Error("mode:"+i)}else if(e<27)switch(i){case L.MODE_NUMBER:return 12;case L.MODE_ALPHA_NUM:return 11;case L.MODE_8BIT_BYTE:return 16;case L.MODE_KANJI:return 10;default:throw new Error("mode:"+i)}else if(e<41)switch(i){case L.MODE_NUMBER:return 14;case L.MODE_ALPHA_NUM:return 13;case L.MODE_8BIT_BYTE:return 16;case L.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 c=-1;c<=1;c++)n+c<0||e<=n+c||a===0&&c===0||o===i.isDark(r+a,n+c)&&s++;s>5&&(t+=3+s-5)}for(r=0;r<e-1;r++)for(n=0;n<e-1;n++){var l=0;i.isDark(r,n)&&l++,i.isDark(r+1,n)&&l++,i.isDark(r,n+1)&&l++,i.isDark(r+1,n+1)&&l++,(l===0||l===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 f=Math.abs(100*u/e/e-50)/5;return t+=f*10,t}};Jt.exports=C});var ze=P((Mi,Yt)=>{h();Yt.exports={L:1,M:0,Q:3,H:2}});var Zt=P((Di,zt)=>{h();var ue=ze();function R(i,e){this.totalCount=i,this.dataCount=e}R.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]];R.getRSBlocks=function(i,e){var t=R.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],c=t[s*3+2],l=0;l<o;l++)n.push(new R(a,c));return n};R.getRsBlockTable=function(i,e){switch(e){case ue.L:return R.RS_BLOCK_TABLE[(i-1)*4+0];case ue.M:return R.RS_BLOCK_TABLE[(i-1)*4+1];case ue.Q:return R.RS_BLOCK_TABLE[(i-1)*4+2];case ue.H:return R.RS_BLOCK_TABLE[(i-1)*4+3];default:return}};zt.exports=R});var rr=P((Ii,tr)=>{h();function er(){this.buffer=[],this.length=0}er.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++}};tr.exports=er});var or=P((Ni,sr)=>{h();var Yr=Wt(),j=Xt(),zr=Ye(),nr=Zt(),ir=rr();function I(i,e){this.typeNumber=i,this.errorCorrectLevel=e,this.modules=null,this.moduleCount=0,this.dataCache=null,this.dataList=[]}I.prototype={addData:function(i){var e=new Yr(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=nr.getRSBlocks(i,this.errorCorrectLevel),t=new ir,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(),j.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=I.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=j.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 c=a*n,l=this.modules[s][a];l&&(r.beginFill(0,100),r.moveTo(c,o),r.lineTo(c+n,o),r.lineTo(c+n,o+n),r.lineTo(c,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=j.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=j.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=j.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 c=!1;s<i.length&&(c=(i[s]>>>n&1)===1);var l=j.getMask(e,r,o-a);l&&(c=!c),this.modules[r][o-a]=c,n--,n===-1&&(s++,n=7)}if(r+=t,r<0||this.moduleCount<=r){r-=t,t=-t;break}}}};I.PAD0=236;I.PAD1=17;I.createData=function(i,e,t){for(var r=nr.getRSBlocks(i,e),n=new ir,s=0;s<t.length;s++){var o=t[s];n.put(o.mode,4),n.put(o.getLength(),j.getLengthInBits(o.mode,i)),o.write(n)}for(var a=0,c=0;c<r.length;c++)a+=r[c].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(I.PAD0,8),n.getLengthInBits()>=a*8));)n.put(I.PAD1,8);return I.createBytes(n,r)};I.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 c=e[a].dataCount,l=e[a].totalCount-c;r=Math.max(r,c),n=Math.max(n,l),s[a]=new Array(c);for(var u=0;u<s[a].length;u++)s[a][u]=255&i.buffer[u+t];t+=c;var f=j.getErrorCorrectPolynomial(l),w=new zr(s[a],f.getLength()-1),v=w.mod(f);o[a]=new Array(f.getLength()-1);for(var d=0;d<o[a].length;d++){var T=d+v.getLength()-o[a].length;o[a][d]=T>=0?v.get(T):0}}for(var $=0,p=0;p<e.length;p++)$+=e[p].totalCount;for(var b=new Array($),H=0,_=0;_<r;_++)for(var N=0;N<e.length;N++)_<s[N].length&&(b[H++]=s[N][_]);for(var m=0;m<n;m++)for(var y=0;y<e.length;y++)m<o[y].length&&(b[H++]=o[y][m]);return b};sr.exports=I});var et=P((Hi,cr)=>{h();var Zr=or(),ar=ze(),en="\x1B[40m \x1B[0m",he="\x1B[47m \x1B[0m",tn=function(i){return i?en:he},Ze=function(i){return{times:function(e){return new Array(e).join(i)}}},rn=function(i,e){for(var t=new Array(i),r=0;r<i;r++)t[r]=e;return t};cr.exports={error:ar.L,generate:function(i,e,t){typeof e=="function"&&(t=e,e={});var r=new Zr(-1,this.error);r.addData(i),r.make();var n="";if(e&&e.small){var s=!0,o=!1,a=r.getModuleCount(),c=r.modules.slice(),l=a%2===1;l&&c.push(rn(a,o));var u={WHITE_ALL:"\u2588",WHITE_BLACK:"\u2580",BLACK_WHITE:"\u2584",BLACK_ALL:" "},f=Ze(u.BLACK_WHITE).times(a+3),w=Ze(u.WHITE_BLACK).times(a+3);n+=f+`
|
|
24
|
+
`;for(var v=0;v<a;v+=2){n+=u.WHITE_ALL;for(var d=0;d<a;d++)c[v][d]===o&&c[v+1][d]===o?n+=u.WHITE_ALL:c[v][d]===o&&c[v+1][d]===s?n+=u.WHITE_BLACK:c[v][d]===s&&c[v+1][d]===o?n+=u.BLACK_WHITE:n+=u.BLACK_ALL;n+=u.WHITE_ALL+`
|
|
25
|
+
`}l||(n+=w)}else{var T=Ze(he).times(r.getModuleCount()+3);n+=T+`
|
|
26
|
+
`,r.modules.forEach(function($){n+=he,n+=$.map(tn).join(""),n+=he+`
|
|
27
|
+
`}),n+=T}t?t(n):console.log(n)},setErrorLevel:function(i){this.error=ar[i]||this.error}}});h();var ee=require("child_process");h();var vt=A(wt(),1),{program:$n,createCommand:Sn,createArgument:Ln,createOption:kn,CommanderError:Mn,InvalidArgumentError:Bn,InvalidOptionArgumentError:Dn,Command:yt,Argument:Rn,Option:In,Help:_n}=vt.default;var O=A(require("fs"),1),fe=A(require("net"),1);h();var qe=A(require("node:process"),1),Ge=require("node:buffer"),Ke=A(require("node:path"),1),Nt=require("node:url"),Ft=require("node:util"),Qe=A(require("node:child_process"),1),oe=A(require("node:fs/promises"),1);h();var _e=A(require("node:process"),1),Z=A(require("node:fs/promises"),1);h();var Ie=A(require("node:process"),1),bt=A(require("node:os"),1),Tt=A(require("node:fs"),1);h();var At=A(require("node:fs"),1);h();var Be=A(require("node:fs"),1),Me;function Rr(){try{return Be.default.statSync("/.dockerenv"),!0}catch{return!1}}function Ir(){try{return Be.default.readFileSync("/proc/self/cgroup","utf8").includes("docker")}catch{return!1}}function De(){return Me===void 0&&(Me=Rr()||Ir()),Me}var Re,_r=()=>{try{return At.default.statSync("/run/.containerenv"),!0}catch{return!1}};function J(){return Re===void 0&&(Re=_r()||De()),Re}var Et=()=>{if(Ie.default.platform!=="linux")return!1;if(bt.default.release().toLowerCase().includes("microsoft"))return!J();try{return Tt.default.readFileSync("/proc/version","utf8").toLowerCase().includes("microsoft")?!J():!1}catch{return!1}},U=Ie.default.env.me?Et:Et();var Nr=(()=>{let i="/mnt/",e;return async function(){if(e)return e;let t="/etc/wsl.conf",r=!1;try{await Z.default.access(t,Z.constants.F_OK),r=!0}catch{}if(!r)return i;let n=await Z.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}})(),Fr=async()=>`${await Nr()}c/Windows/System32/WindowsPowerShell/v1.0/powershell.exe`,Ne=async()=>U?Fr():`${_e.default.env.SYSTEMROOT||_e.default.env.windir||String.raw`C:\Windows`}\\System32\\WindowsPowerShell\\v1.0\\powershell.exe`;h();function V(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 Mt=require("node:util"),ie=A(require("node:process"),1),Bt=require("node:child_process");h();var xt=require("node:util"),Pt=A(require("node:process"),1),Ct=require("node:child_process"),Hr=(0,xt.promisify)(Ct.execFile);async function Fe(){if(Pt.default.platform!=="darwin")throw new Error("macOS only");let{stdout:i}=await Hr("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 Ot=A(require("node:process"),1),$t=require("node:util"),He=require("node:child_process"),Ur=(0,$t.promisify)(He.execFile);async function St(i,{humanReadableOutput:e=!0,signal:t}={}){if(Ot.default.platform!=="darwin")throw new Error("macOS only");let r=e?[]:["-ss"],n={};t&&(n.signal=t);let{stdout:s}=await Ur("osascript",["-e",i,r],n);return s.trim()}async function Ue(i){return St(`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 Lt=require("node:util"),kt=require("node:child_process"),Vr=(0,Lt.promisify)(kt.execFile),Wr={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"}},ne=class extends Error{};async function Ve(i=Vr){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 ne(`Cannot find Windows browser in stdout: ${JSON.stringify(e)}`);let{id:r}=t.groups,n=Wr[r];if(!n)throw new ne(`Unknown browser ID: ${r}`);return n}var jr=(0,Mt.promisify)(Bt.execFile),qr=i=>i.toLowerCase().replaceAll(/(?:^|\s|-)\S/g,e=>e.toUpperCase());async function We(){if(ie.default.platform==="darwin"){let i=await Fe();return{name:await Ue(i),id:i}}if(ie.default.platform==="linux"){let{stdout:i}=await jr("xdg-mime",["query","default","x-scheme-handler/http"]),e=i.trim();return{name:qr(e.replace(/.desktop$/,"").replace("-"," ")),id:e}}if(ie.default.platform==="win32")return Ve();throw new Error("Only macOS, Linux, and Windows are supported")}var Gr=(0,Ft.promisify)(Qe.default.execFile),je=Ke.default.dirname((0,Nt.fileURLToPath)(g)),Dt=Ke.default.join(je,"xdg-open"),{platform:X,arch:Rt}=qe.default;async function Kr(){let i=await Ne(),e=String.raw`(Get-ItemProperty -Path "HKCU:\Software\Microsoft\Windows\Shell\Associations\UrlAssociations\http\UserChoice").ProgId`,t=Ge.Buffer.from(e,"utf16le").toString("base64"),{stdout:r}=await Gr(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 It=async(i,e)=>{let t;for(let r of i)try{return await e(r)}catch(n){t=n}throw t},se=async i=>{if(i={wait:!1,background:!1,newInstance:!1,allowNonzeroExitCode:!1,...i},Array.isArray(i.app))return It(i.app,a=>se({...i,app:a}));let{name:e,arguments:t=[]}=i.app??{};if(t=[...t],Array.isArray(e))return It(e,a=>se({...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"},c={chrome:"--incognito",brave:"--incognito",firefox:"--private-window",edge:"--inPrivate"},l=U?await Kr():await We();if(l.id in a){let u=a[l.id];return e==="browserPrivate"&&t.push(c[u]),se({...i,app:{name:K[u],arguments:t}})}throw new Error(`${l.name} is not supported as a default browser`)}let r,n=[],s={};if(X==="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(X==="win32"||U&&!J()&&!e){r=await Ne(),n.push("-NoProfile","-NonInteractive","-ExecutionPolicy","Bypass","-EncodedCommand"),U||(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(c=>`"\`"${c}\`""`),a.push("-ArgumentList",t.join(","))),i.target=Ge.Buffer.from(a.join(" "),"utf16le").toString("base64")}else{if(e)r=e;else{let a=!je||je==="/",c=!1;try{await oe.default.access(Dt,oe.constants.X_OK),c=!0}catch{}r=qe.default.versions.electron??(X==="android"||a||!c)?"xdg-open":Dt}t.length>0&&n.push(...t),i.wait||(s.stdio="ignore",s.detached=!0)}X==="darwin"&&t.length>0&&n.push("--args",...t),i.target&&n.push(i.target);let o=Qe.default.spawn(r,n,s);return i.wait?new Promise((a,c)=>{o.once("error",c),o.once("close",l=>{if(!i.allowNonzeroExitCode&&l>0){c(new Error(`Exited with code ${l}`));return}a(o)})}):(o.unref(),o)},Qr=(i,e)=>{if(typeof i!="string")throw new TypeError("Expected a `target`");return se({...e,target:i})};function _t(i){if(typeof i=="string"||Array.isArray(i))return i;let{[Rt]:e}=i;if(!e)throw new Error(`${Rt} is not supported`);return e}function ae({[X]:i},{wsl:e}){if(e&&U)return _t(e);if(!i)throw new Error(`${X} is not supported`);return _t(i)}var K={};V(K,"chrome",()=>ae({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"]}}));V(K,"brave",()=>ae({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"]}}));V(K,"firefox",()=>ae({darwin:"firefox",win32:String.raw`C:\Program Files\Mozilla Firefox\firefox.exe`,linux:"firefox"},{wsl:"/mnt/c/Program Files/Mozilla Firefox/firefox.exe"}));V(K,"edge",()=>ae({darwin:"microsoft edge",win32:"msedge",linux:["microsoft-edge","microsoft-edge-dev"]},{wsl:"/mnt/c/Program Files (x86)/Microsoft/Edge/Application/msedge.exe"}));V(K,"browser",()=>"browser");V(K,"browserPrivate",()=>"browserPrivate");var ce=Qr;var me=A(require("os"),1),B=A(require("path"),1),Y=process.env.POKE_API??"https://poke.com/api/v1",tt=process.env.POKE_FRONTEND??"https://poke.com",nn=`
|
|
29
29
|
@@@@@@@ @@@@@@@@
|
|
30
30
|
@@@@@@@@@@@@ @@@@@@@@@@@@@
|
|
31
31
|
@@@@@@@@@@ @@@@@@@@@@
|
|
@@ -51,56 +51,56 @@ 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(`${
|
|
54
|
+
`;function pe(){let i=process.env.XDG_CONFIG_HOME;return i?B.default.join(i,"poke"):B.default.join(me.default.homedir(),".config","poke")}function rt(){return B.default.join(pe(),"credentials.json")}function sn(i){let e=pe(),t=rt();O.default.mkdirSync(e,{recursive:!0});let r={token:i};O.default.writeFileSync(t,JSON.stringify(r,null,2));try{O.default.chmodSync(t,384)}catch{}}function de(){try{let i=O.default.readFileSync(rt(),"utf-8");return JSON.parse(i)}catch{return null}}function ur(){try{O.default.unlinkSync(rt())}catch{}}async function k(i,e={}){let t=de();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(`${Y}${i}`,{...e,headers:r});return n.status===401&&(ur(),console.error("Session expired. Run 'poke login' again."),process.exit(1)),n}function nt(i){return new Promise(e=>setTimeout(e,i))}async function hr(){if(de()?.token){console.log("Already logged in. Run 'poke logout' first to switch accounts.");return}console.log(nn),console.log(`Starting login...
|
|
55
|
+
`);let e=await fetch(`${Y}/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=`${tt}/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 ce(n)}catch{}let s=5*60*1e3,o=2e3,a=Date.now()+s;for(;Date.now()<a;){await nt(o);let l=await(await fetch(`${Y}/cli-auth/poll/${t}`)).json();if(l.status==="authenticated"){sn(l.token),console.log(`
|
|
60
60
|
\u2713 Logged in successfully!
|
|
61
|
-
`);return}
|
|
61
|
+
`);return}l.status==="expired"&&(console.error(`
|
|
62
62
|
Code expired. Run 'poke login' again.
|
|
63
|
-
`),process.exit(1)),
|
|
63
|
+
`),process.exit(1)),l.status==="invalid"&&(console.error(`
|
|
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 on(){ur(),console.log("Logged out.")}async function an(){let i=await k("/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 q=new yt;q.name("poke").description("Poke CLI - Create tunnels to expose local servers").version("0.1.0");q.command("login").description("Log in to Poke").action(hr);q.command("logout").description("Log out").action(on);q.command("whoami").description("Show current user").action(an);var lr="0.7.0";function cn(){let i=process.env.XDG_CACHE_HOME;return i?B.default.join(i,"poke","bin"):B.default.join(me.default.homedir(),".cache","poke","bin")}async function fr(){let i=cn(),e=B.default.join(i,`piko-${lr}`);if(O.default.existsSync(e))return e;if(O.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${lr}/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 O.default.writeFileSync(e,Buffer.from(o)),O.default.chmodSync(e,493),e}var ln=q.command("mcp").description("Manage MCP server connections");ln.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 k("/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
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
|
+
`)});q.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").option("--recipe","Create a shareable recipe with QR code").option("--client-id <id>","OAuth client ID").option("--client-secret <secret>","OAuth client secret").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=await
|
|
76
|
-
Failed to create tunnel: ${
|
|
77
|
-
`),process.exit(1)}let
|
|
75
|
+
`),process.exit(1)}let r={name:e.name,serverUrl:i,tunnel:!0};e.clientId&&(r.clientId=e.clientId),e.clientSecret&&(r.clientSecret=e.clientSecret);let n=await k("/mcp/connections/cli",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(r)});if(!n.ok){let p=await n.text(),b=`HTTP ${n.status}`;try{b=JSON.parse(p).message??b}catch{}console.error(`
|
|
76
|
+
Failed to create tunnel: ${b}
|
|
77
|
+
`),process.exit(1)}let s=await n.json();(!s.tunnel?.token||!s.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)})
|
|
84
|
-
Tunnel agent failed to start (exit ${
|
|
79
|
+
`),process.exit(1));let o;try{o=await fr()}catch(p){console.error(`
|
|
80
|
+
Failed to download tunnel agent: ${p instanceof Error?p.message:p}
|
|
81
|
+
`),process.exit(1)}let a=t.host,c=(0,ee.spawn)(o,["agent","http",s.id,a,"--connect.url",s.tunnel.upstreamUrl,"--connect.token",s.tunnel.token]);c.on("error",p=>{console.error(`
|
|
82
|
+
Failed to start tunnel agent: ${p.message}
|
|
83
|
+
`),process.exit(1)});let l=pe();O.default.mkdirSync(l,{recursive:!0});let u=O.default.createWriteStream(B.default.join(l,"error.log"),{flags:"a"});c.stderr?.on("data",p=>u.write(p)),await nt(2e3),c.exitCode!==null&&(console.error(`
|
|
84
|
+
Tunnel agent failed to start (exit ${c.exitCode}).
|
|
85
85
|
`),process.exit(1)),console.log(`
|
|
86
86
|
Tunnel is active!
|
|
87
|
-
`),console.log(` Tunnel URL: ${
|
|
87
|
+
`),console.log(` Tunnel URL: ${s.serverUrl}`),console.log(` Local: ${i}`),console.log(` Name: ${s.name}`);let f=async()=>{try{let p=await k(`/mcp/connections/${s.id}/sync-tools`,{method:"POST"});p.ok?console.log(`[${new Date().toLocaleTimeString()}] Tools synced.`):console.error(`[${new Date().toLocaleTimeString()}] Tool sync failed (HTTP ${p.status}).`)}catch{console.error(`[${new Date().toLocaleTimeString()}] Tool sync failed.`)}},w=await k(`/mcp/connections/${s.id}/activate-tunnel`,{method:"POST"});if(w.ok){let p=await w.json();if(p.status==="authenticated")console.log(`[${new Date().toLocaleTimeString()}] Connection activated and tools synced.`);else if(p.status==="oauth_required"){console.log(`
|
|
88
88
|
This MCP server requires OAuth authentication.
|
|
89
|
-
|
|
90
|
-
`);try{await
|
|
91
|
-
Recipe: ${
|
|
89
|
+
`),console.log(` Auth URL: ${p.authUrl}
|
|
90
|
+
`);try{await ce(p.authUrl)}catch{}}}else console.error(`[${new Date().toLocaleTimeString()}] Activation failed (HTTP ${w.status}). Falling back to periodic sync.`),await f();if(e.recipe){let p=s.recipe?.link;if(!p){let b=await k(`/mcp/connections/${s.id}/create-recipe`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({name:e.name})});b.ok?p=(await b.json()).link:console.error(`[${new Date().toLocaleTimeString()}] Failed to create recipe (HTTP ${b.status}).`)}if(p){let b=new URL(Y).origin;p=p.replace(b,tt),console.log(`
|
|
91
|
+
Recipe: ${p}
|
|
92
92
|
`),console.log(`Share this recipe link so others can use your tunnel:
|
|
93
|
-
`)
|
|
94
|
-
`);let
|
|
95
|
-
Removing MCP connection...`);try{await
|
|
93
|
+
`);let H=await Promise.resolve().then(()=>A(et(),1));(H.default??H).generate(p,{small:!0},N=>{console.log(N)})}}console.log(`Press Ctrl+C to stop the tunnel.
|
|
94
|
+
`);let v=setInterval(f,5*60*1e3),d=!1,T=async()=>{if(!d){d=!0,clearInterval(v),console.log(`
|
|
95
|
+
Removing MCP connection...`);try{await k(`/mcp/connections/${s.id}`,{method:"DELETE"}),console.log(`MCP connection removed.
|
|
96
96
|
`)}catch{console.error(`Failed to remove MCP connection.
|
|
97
|
-
`)}
|
|
98
|
-
Tunnel stopped${
|
|
99
|
-
`),
|
|
97
|
+
`)}c.exitCode===null&&c.kill(),process.exit(0)}};process.on("SIGINT",T),process.on("SIGTERM",T);let $=await new Promise(p=>{c.on("exit",b=>{console.log(`
|
|
98
|
+
Tunnel stopped${b?` (exit ${b})`:""}.
|
|
99
|
+
`),p(b??0)})});d||process.exit($)});function un(i){return new Promise((e,t)=>{let r=fe.default.createServer();r.listen(i,()=>{let{port:n}=r.address();r.close(()=>e(n))}),r.on("error",()=>{let n=fe.default.createServer();n.listen(0,()=>{let{port:s}=n.address();n.close(()=>e(s))}),n.on("error",t)})})}function hn(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=fe.default.createConnection({port:i,host:"127.0.0.1"},()=>{o.destroy(),r()});o.on("error",()=>{setTimeout(s,500)})};s()})}q.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").action(async i=>{let e=de();e?.token||(await hr(),e=de(),e?.token||(console.error("Login failed."),process.exit(1))),(0,ee.spawnSync)("uv",["--version"],{stdio:"ignore"}).status!==0&&(console.error(`uv is required but not installed.
|
|
100
100
|
|
|
101
101
|
Install it with:
|
|
102
102
|
curl -LsSf https://astral.sh/uv/install.sh | sh
|
|
103
|
-
`),process.exit(1));let r=process.cwd(),n=await
|
|
103
|
+
`),process.exit(1));let r=process.cwd(),n=await un(parseInt(i.port,10)),s=B.default.join(me.default.tmpdir(),"poke-wrap",`wrap-${Date.now()}`);O.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.
|
|
104
104
|
|
|
105
105
|
## Your Task
|
|
106
106
|
|
|
@@ -161,31 +161,32 @@ Install it with:
|
|
|
161
161
|
- Include proper error handling in every tool
|
|
162
162
|
- Tools should work with the project as-is
|
|
163
163
|
- You MUST install deps and start the server using the Bash tool before finishing`;console.log(`Analyzing project and generating MCP server...
|
|
164
|
-
`);try{let{query:
|
|
165
|
-
Failed to generate MCP server
|
|
166
|
-
Failed to run AI agent: ${
|
|
167
|
-
`);try{await
|
|
168
|
-
`);let a=`http://localhost:${n}/mcp`,l=i.name
|
|
169
|
-
Failed to create tunnel: ${
|
|
170
|
-
`),process.exit(1)}let
|
|
164
|
+
`);try{let{query:m}=await import("@anthropic-ai/claude-agent-sdk");for await(let y of m({prompt:o,options:{cwd:r,allowedTools:["Read","Write","Bash","Glob","Grep"],permissionMode:"bypassPermissions",allowDangerouslySkipPermissions:!0,maxTurns:30,env:{...process.env,ANTHROPIC_BASE_URL:`${Y}/ai-proxy`,ANTHROPIC_API_KEY:e.token}}})){if(y.type==="assistant")for(let D of y.message.content)D.type==="text"&&D.text&&process.stdout.write(D.text);if(y.type==="result"){let D=y;if(D.subtype!=="success"){let ge=(D.errors??[]).filter(G=>!G.includes("events failed to export")&&!G.includes("Failed to export")&&!G.includes("1P event logging")&&!G.includes("only prompt commands are supported")&&!G.includes("405 status code"));ge.length>0&&(console.error(`
|
|
165
|
+
Failed to generate MCP server:`,ge),process.exit(1))}}}}catch(m){console.error(`
|
|
166
|
+
Failed to run AI agent: ${m instanceof Error?m.message:m}`),console.error("Make sure @anthropic-ai/claude-agent-sdk is installed."),process.exit(1)}console.log(`
|
|
167
|
+
`);try{await hn(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`,c=Math.random().toString(36).slice(2,6),l=i.name??`${B.default.basename(r)}-${c}`,u=await k("/mcp/connections/cli",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({name:l,serverUrl:a,tunnel:!0})});if(!u.ok){let m=await u.text(),y=`HTTP ${u.status}`;try{y=JSON.parse(m).message??y}catch{}console.error(`
|
|
169
|
+
Failed to create tunnel: ${y}
|
|
170
|
+
`),process.exit(1)}let f=await u.json();(!f.tunnel?.token||!f.tunnel?.upstreamUrl)&&(console.error(`
|
|
171
171
|
Tunnel configuration not available.
|
|
172
|
-
`),process.exit(1));let
|
|
173
|
-
Failed to download tunnel agent: ${
|
|
174
|
-
`),process.exit(1)}let v=new URL(a).host,
|
|
175
|
-
Failed to start tunnel agent: ${
|
|
176
|
-
`),process.exit(1)})
|
|
177
|
-
Tunnel agent failed to start (exit ${
|
|
172
|
+
`),process.exit(1));let w;try{w=await fr()}catch(m){console.error(`
|
|
173
|
+
Failed to download tunnel agent: ${m instanceof Error?m.message:m}
|
|
174
|
+
`),process.exit(1)}let v=new URL(a).host,d=(0,ee.spawn)(w,["agent","http",f.id,v,"--connect.url",f.tunnel.upstreamUrl,"--connect.token",f.tunnel.token]);d.on("error",m=>{console.error(`
|
|
175
|
+
Failed to start tunnel agent: ${m.message}
|
|
176
|
+
`),process.exit(1)});let T=pe();O.default.mkdirSync(T,{recursive:!0});let $=O.default.createWriteStream(B.default.join(T,"error.log"),{flags:"a"});d.stderr?.on("data",m=>$.write(m)),await nt(2e3),d.exitCode!==null&&(console.error(`
|
|
177
|
+
Tunnel agent failed to start (exit ${d.exitCode}).
|
|
178
178
|
`),process.exit(1)),console.log(`Tunnel is active!
|
|
179
|
-
`),console.log(` Tunnel URL: ${
|
|
180
|
-
`)
|
|
181
|
-
|
|
182
|
-
`),
|
|
183
|
-
`);let
|
|
179
|
+
`),console.log(` Tunnel URL: ${f.serverUrl}`),console.log(` Local: ${a}`),console.log(` Name: ${l}
|
|
180
|
+
`);{let m=f.recipe?.link;if(!m){let y=await k(`/mcp/connections/${f.id}/create-recipe`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({name:l})});y.ok?m=(await y.json()).link:console.error(`[${new Date().toLocaleTimeString()}] Failed to create recipe (HTTP ${y.status}).`)}if(m){let y=new URL(Y).origin;m=m.replace(y,tt),console.log(`
|
|
181
|
+
Recipe: ${m}
|
|
182
|
+
`),console.log(`Share this recipe link so others can use your tunnel:
|
|
183
|
+
`);let D=await Promise.resolve().then(()=>A(et(),1));(D.default??D).generate(m,{small:!0},G=>{console.log(G)})}}console.log(`Press Ctrl+C to stop.
|
|
184
|
+
`);let p=async()=>{try{let m=await k(`/mcp/connections/${f.id}/sync-tools`,{method:"POST"});m.ok?console.log(`[${new Date().toLocaleTimeString()}] Tools synced.`):console.error(`[${new Date().toLocaleTimeString()}] Tool sync failed (HTTP ${m.status}).`)}catch{console.error(`[${new Date().toLocaleTimeString()}] Tool sync failed.`)}},b=await k(`/mcp/connections/${f.id}/activate-tunnel`,{method:"POST"});if(b.ok){let m=await b.json();if(m.status==="authenticated")console.log(`[${new Date().toLocaleTimeString()}] Connection activated and tools synced.`);else if(m.status==="oauth_required"){console.log(`
|
|
184
185
|
This MCP server requires OAuth authentication.
|
|
185
|
-
|
|
186
|
-
`);try{await
|
|
187
|
-
Removing MCP connection...`);try{await
|
|
186
|
+
`),console.log(` Auth URL: ${m.authUrl}
|
|
187
|
+
`);try{await ce(m.authUrl)}catch{}}}else console.error(`[${new Date().toLocaleTimeString()}] Activation failed (HTTP ${b.status}). Falling back to periodic sync.`),await p();let H=setInterval(p,5*60*1e3),_=!1,N=async()=>{if(!_){_=!0,clearInterval(H),console.log(`
|
|
188
|
+
Removing MCP connection...`);try{await k(`/mcp/connections/${f.id}`,{method:"DELETE"}),console.log(`MCP connection removed.
|
|
188
189
|
`)}catch{console.error(`Failed to remove MCP connection.
|
|
189
|
-
`)}
|
|
190
|
-
Tunnel stopped${
|
|
191
|
-
`),
|
|
190
|
+
`)}d.exitCode===null&&d.kill(),process.exit(0)}};process.on("SIGINT",N),process.on("SIGTERM",N),await new Promise(m=>{d.on("exit",y=>{console.log(`
|
|
191
|
+
Tunnel stopped${y?` (exit ${y})`:""}.
|
|
192
|
+
`),m()})}),_||process.exit(0)});process.argv.length<=2&&process.argv.push("wrap");q.parse();
|