@seeka-labs/cli-apps 1.1.3 → 1.1.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.js +20 -17
- package/dist/index.js.map +7 -0
- package/dist/init-templates/browser/.editorconfig +14 -0
- package/dist/init-templates/browser/jest.config.js +11 -0
- package/dist/init-templates/browser/src/browser.ts +12 -0
- package/dist/init-templates/browser/src/plugin/index.test.ts +6 -0
- package/dist/init-templates/browser/src/plugin/index.ts +158 -0
- package/dist/init-templates/browser/tsconfig.json +35 -0
- package/package.json +6 -7
package/dist/index.js
CHANGED
|
@@ -1,26 +1,29 @@
|
|
|
1
1
|
#! /usr/bin/env node
|
|
2
|
-
"use strict";var xt=Object.create;var ce=Object.defineProperty;var St=Object.getOwnPropertyDescriptor;var kt=Object.getOwnPropertyNames;var $t=Object.getPrototypeOf,Vt=Object.prototype.hasOwnProperty;var _=(i,e)=>()=>(e||i((e={exports:{}}).exports,e),e.exports);var Nt=(i,e,t,n)=>{if(e&&typeof e=="object"||typeof e=="function")for(let s of kt(e))!Vt.call(i,s)&&s!==t&&ce(i,s,{get:()=>e[s],enumerable:!(n=St(e,s))||n.enumerable});return i};var v=(i,e,t)=>(t=i!=null?xt($t(i)):{},Nt(e||!i||!i.__esModule?ce(t,"default",{value:i,enumerable:!0}):t,i));var V=_(I=>{var H=class extends Error{constructor(e,t,n){super(n),Error.captureStackTrace(this,this.constructor),this.name=this.constructor.name,this.code=t,this.exitCode=e,this.nestedError=void 0}},D=class extends H{constructor(e){super(1,"commander.invalidArgument",e),Error.captureStackTrace(this,this.constructor),this.name=this.constructor.name}};I.CommanderError=H;I.InvalidArgumentError=D});var P=_(F=>{var{InvalidArgumentError:Ht}=V(),q=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._name=e.slice(1,-1);break;case"[":this.required=!1,this._name=e.slice(1,-1);break;default:this.required=!0,this._name=e;break}this._name.length>3&&this._name.slice(-3)==="..."&&(this.variadic=!0,this._name=this._name.slice(0,-3))}name(){return this._name}_concatValue(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,n)=>{if(!this.argChoices.includes(t))throw new Ht(`Allowed choices are ${this.argChoices.join(", ")}.`);return this.variadic?this._concatValue(t,n):t},this}argRequired(){return this.required=!0,this}argOptional(){return this.required=!1,this}};function Pt(i){let e=i.name()+(i.variadic===!0?"...":"");return i.required?"<"+e+">":"["+e+"]"}F.Argument=q;F.humanReadableArgName=Pt});var L=_(ue=>{var{humanReadableArgName:jt}=P(),M=class{constructor(){this.helpWidth=void 0,this.sortSubcommands=!1,this.sortOptions=!1,this.showGlobalOptions=!1}visibleCommands(e){let t=e.commands.filter(s=>!s._hidden),n=e._getHelpCommand();return n&&!n._hidden&&t.push(n),this.sortSubcommands&&t.sort((s,r)=>s.name().localeCompare(r.name())),t}compareOptions(e,t){let n=s=>s.short?s.short.replace(/^-/,""):s.long.replace(/^--/,"");return n(e).localeCompare(n(t))}visibleOptions(e){let t=e.options.filter(s=>!s.hidden),n=e._getHelpOption();if(n&&!n.hidden){let s=n.short&&e._findOption(n.short),r=n.long&&e._findOption(n.long);!s&&!r?t.push(n):n.long&&!r?t.push(e.createOption(n.long,n.description)):n.short&&!s&&t.push(e.createOption(n.short,n.description))}return this.sortOptions&&t.sort(this.compareOptions),t}visibleGlobalOptions(e){if(!this.showGlobalOptions)return[];let t=[];for(let n=e.parent;n;n=n.parent){let s=n.options.filter(r=>!r.hidden);t.push(...s)}return this.sortOptions&&t.sort(this.compareOptions),t}visibleArguments(e){return e._argsDescription&&e.registeredArguments.forEach(t=>{t.description=t.description||e._argsDescription[t.name()]||""}),e.registeredArguments.find(t=>t.description)?e.registeredArguments:[]}subcommandTerm(e){let t=e.registeredArguments.map(n=>jt(n)).join(" ");return e._name+(e._aliases[0]?"|"+e._aliases[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((n,s)=>Math.max(n,t.subcommandTerm(s).length),0)}longestOptionTermLength(e,t){return t.visibleOptions(e).reduce((n,s)=>Math.max(n,t.optionTerm(s).length),0)}longestGlobalOptionTermLength(e,t){return t.visibleGlobalOptions(e).reduce((n,s)=>Math.max(n,t.optionTerm(s).length),0)}longestArgumentTermLength(e,t){return t.visibleArguments(e).reduce((n,s)=>Math.max(n,t.argumentTerm(s).length),0)}commandUsage(e){let t=e._name;e._aliases[0]&&(t=t+"|"+e._aliases[0]);let n="";for(let s=e.parent;s;s=s.parent)n=s.name()+" "+n;return n+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(n=>JSON.stringify(n)).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(n=>JSON.stringify(n)).join(", ")}`),e.defaultValue!==void 0&&t.push(`default: ${e.defaultValueDescription||JSON.stringify(e.defaultValue)}`),t.length>0){let n=`(${t.join(", ")})`;return e.description?`${e.description} ${n}`:n}return e.description}formatHelp(e,t){let n=t.padWidth(e,t),s=t.helpWidth||80,r=2,m=2;function l(d,w){if(w){let $=`${d.padEnd(n+m)}${w}`;return t.wrap($,s-r,n+m)}return d}function o(d){return d.join(`
|
|
3
|
-
|
|
4
|
-
|
|
2
|
+
"use strict";var un=Object.create;var ft=Object.defineProperty;var cn=Object.getOwnPropertyDescriptor;var hn=Object.getOwnPropertyNames;var fn=Object.getPrototypeOf,pn=Object.prototype.hasOwnProperty;var v=(r,e)=>()=>(e||r((e={exports:{}}).exports,e),e.exports);var dn=(r,e,t,n)=>{if(e&&typeof e=="object"||typeof e=="function")for(let i of hn(e))!pn.call(r,i)&&i!==t&&ft(r,i,{get:()=>e[i],enumerable:!(n=cn(e,i))||n.enumerable});return r};var U=(r,e,t)=>(t=r!=null?un(fn(r)):{},dn(e||!r||!r.__esModule?ft(t,"default",{value:r,enumerable:!0}):t,r));var dt=v(ge=>{var pt="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/".split("");ge.encode=function(r){if(0<=r&&r<pt.length)return pt[r];throw new TypeError("Must be between 0 and 63: "+r)};ge.decode=function(r){var e=65,t=90,n=97,i=122,s=48,o=57,l=43,a=47,m=26,u=52;return e<=r&&r<=t?r-e:n<=r&&r<=i?r-n+m:s<=r&&r<=o?r-s+u:r==l?62:r==a?63:-1}});var ye=v(ve=>{var gt=dt(),_e=5,_t=1<<_e,vt=_t-1,yt=_t;function gn(r){return r<0?(-r<<1)+1:(r<<1)+0}function _n(r){var e=(r&1)===1,t=r>>1;return e?-t:t}ve.encode=function(e){var t="",n,i=gn(e);do n=i&vt,i>>>=_e,i>0&&(n|=yt),t+=gt.encode(n);while(i>0);return t};ve.decode=function(e,t,n){var i=e.length,s=0,o=0,l,a;do{if(t>=i)throw new Error("Expected more digits in base 64 VLQ value.");if(a=gt.decode(e.charCodeAt(t++)),a===-1)throw new Error("Invalid base64 digit: "+e.charAt(t-1));l=!!(a&yt),a&=vt,s=s+(a<<o),o+=_e}while(l);n.value=_n(s),n.rest=t}});var z=v(E=>{function vn(r,e,t){if(e in r)return r[e];if(arguments.length===3)return t;throw new Error('"'+e+'" is a required argument.')}E.getArg=vn;var wt=/^(?:([\w+\-.]+):)?\/\/(?:(\w+:\w+)@)?([\w.-]*)(?::(\d+))?(.*)$/,yn=/^data:.+\,.+$/;function Z(r){var e=r.match(wt);return e?{scheme:e[1],auth:e[2],host:e[3],port:e[4],path:e[5]}:null}E.urlParse=Z;function B(r){var e="";return r.scheme&&(e+=r.scheme+":"),e+="//",r.auth&&(e+=r.auth+"@"),r.host&&(e+=r.host),r.port&&(e+=":"+r.port),r.path&&(e+=r.path),e}E.urlGenerate=B;function we(r){var e=r,t=Z(r);if(t){if(!t.path)return r;e=t.path}for(var n=E.isAbsolute(e),i=e.split(/\/+/),s,o=0,l=i.length-1;l>=0;l--)s=i[l],s==="."?i.splice(l,1):s===".."?o++:o>0&&(s===""?(i.splice(l+1,o),o=0):(i.splice(l,2),o--));return e=i.join("/"),e===""&&(e=n?"/":"."),t?(t.path=e,B(t)):e}E.normalize=we;function Ct(r,e){r===""&&(r="."),e===""&&(e=".");var t=Z(e),n=Z(r);if(n&&(r=n.path||"/"),t&&!t.scheme)return n&&(t.scheme=n.scheme),B(t);if(t||e.match(yn))return e;if(n&&!n.host&&!n.path)return n.host=e,B(n);var i=e.charAt(0)==="/"?e:we(r.replace(/\/+$/,"")+"/"+e);return n?(n.path=i,B(n)):i}E.join=Ct;E.isAbsolute=function(r){return r.charAt(0)==="/"||wt.test(r)};function wn(r,e){r===""&&(r="."),r=r.replace(/\/$/,"");for(var t=0;e.indexOf(r+"/")!==0;){var n=r.lastIndexOf("/");if(n<0||(r=r.slice(0,n),r.match(/^([^\/]+:\/)?\/*$/)))return e;++t}return Array(t+1).join("../")+e.substr(r.length+1)}E.relative=wn;var St=function(){var r=Object.create(null);return!("__proto__"in r)}();function bt(r){return r}function Cn(r){return At(r)?"$"+r:r}E.toSetString=St?bt:Cn;function Sn(r){return At(r)?r.slice(1):r}E.fromSetString=St?bt:Sn;function At(r){if(!r)return!1;var e=r.length;if(e<9||r.charCodeAt(e-1)!==95||r.charCodeAt(e-2)!==95||r.charCodeAt(e-3)!==111||r.charCodeAt(e-4)!==116||r.charCodeAt(e-5)!==111||r.charCodeAt(e-6)!==114||r.charCodeAt(e-7)!==112||r.charCodeAt(e-8)!==95||r.charCodeAt(e-9)!==95)return!1;for(var t=e-10;t>=0;t--)if(r.charCodeAt(t)!==36)return!1;return!0}function bn(r,e,t){var n=W(r.source,e.source);return n!==0||(n=r.originalLine-e.originalLine,n!==0)||(n=r.originalColumn-e.originalColumn,n!==0||t)||(n=r.generatedColumn-e.generatedColumn,n!==0)||(n=r.generatedLine-e.generatedLine,n!==0)?n:W(r.name,e.name)}E.compareByOriginalPositions=bn;function An(r,e,t){var n=r.generatedLine-e.generatedLine;return n!==0||(n=r.generatedColumn-e.generatedColumn,n!==0||t)||(n=W(r.source,e.source),n!==0)||(n=r.originalLine-e.originalLine,n!==0)||(n=r.originalColumn-e.originalColumn,n!==0)?n:W(r.name,e.name)}E.compareByGeneratedPositionsDeflated=An;function W(r,e){return r===e?0:r===null?1:e===null?-1:r>e?1:-1}function En(r,e){var t=r.generatedLine-e.generatedLine;return t!==0||(t=r.generatedColumn-e.generatedColumn,t!==0)||(t=W(r.source,e.source),t!==0)||(t=r.originalLine-e.originalLine,t!==0)||(t=r.originalColumn-e.originalColumn,t!==0)?t:W(r.name,e.name)}E.compareByGeneratedPositionsInflated=En;function On(r){return JSON.parse(r.replace(/^\)]}'[^\n]*\n/,""))}E.parseSourceMapInput=On;function xn(r,e,t){if(e=e||"",r&&(r[r.length-1]!=="/"&&e[0]!=="/"&&(r+="/"),e=r+e),t){var n=Z(t);if(!n)throw new Error("sourceMapURL could not be parsed");if(n.path){var i=n.path.lastIndexOf("/");i>=0&&(n.path=n.path.substring(0,i+1))}e=Ct(B(n),e)}return we(e)}E.computeSourceURL=xn});var be=v(Et=>{var Ce=z(),Se=Object.prototype.hasOwnProperty,T=typeof Map<"u";function $(){this._array=[],this._set=T?new Map:Object.create(null)}$.fromArray=function(e,t){for(var n=new $,i=0,s=e.length;i<s;i++)n.add(e[i],t);return n};$.prototype.size=function(){return T?this._set.size:Object.getOwnPropertyNames(this._set).length};$.prototype.add=function(e,t){var n=T?e:Ce.toSetString(e),i=T?this.has(e):Se.call(this._set,n),s=this._array.length;(!i||t)&&this._array.push(e),i||(T?this._set.set(e,s):this._set[n]=s)};$.prototype.has=function(e){if(T)return this._set.has(e);var t=Ce.toSetString(e);return Se.call(this._set,t)};$.prototype.indexOf=function(e){if(T){var t=this._set.get(e);if(t>=0)return t}else{var n=Ce.toSetString(e);if(Se.call(this._set,n))return this._set[n]}throw new Error('"'+e+'" is not in the set.')};$.prototype.at=function(e){if(e>=0&&e<this._array.length)return this._array[e];throw new Error("No element indexed by "+e)};$.prototype.toArray=function(){return this._array.slice()};Et.ArraySet=$});var kt=v(xt=>{var Ot=z();function kn(r,e){var t=r.generatedLine,n=e.generatedLine,i=r.generatedColumn,s=e.generatedColumn;return n>t||n==t&&s>=i||Ot.compareByGeneratedPositionsInflated(r,e)<=0}function oe(){this._array=[],this._sorted=!0,this._last={generatedLine:-1,generatedColumn:0}}oe.prototype.unsortedForEach=function(e,t){this._array.forEach(e,t)};oe.prototype.add=function(e){kn(this._last,e)?(this._last=e,this._array.push(e)):(this._sorted=!1,this._array.push(e))};oe.prototype.toArray=function(){return this._sorted||(this._array.sort(Ot.compareByGeneratedPositionsInflated),this._sorted=!0),this._array};xt.MappingList=oe});var Ae=v(Mt=>{var ee=ye(),S=z(),ae=be().ArraySet,Mn=kt().MappingList;function x(r){r||(r={}),this._file=S.getArg(r,"file",null),this._sourceRoot=S.getArg(r,"sourceRoot",null),this._skipValidation=S.getArg(r,"skipValidation",!1),this._sources=new ae,this._names=new ae,this._mappings=new Mn,this._sourcesContents=null}x.prototype._version=3;x.fromSourceMap=function(e){var t=e.sourceRoot,n=new x({file:e.file,sourceRoot:t});return e.eachMapping(function(i){var s={generated:{line:i.generatedLine,column:i.generatedColumn}};i.source!=null&&(s.source=i.source,t!=null&&(s.source=S.relative(t,s.source)),s.original={line:i.originalLine,column:i.originalColumn},i.name!=null&&(s.name=i.name)),n.addMapping(s)}),e.sources.forEach(function(i){var s=i;t!==null&&(s=S.relative(t,i)),n._sources.has(s)||n._sources.add(s);var o=e.sourceContentFor(i);o!=null&&n.setSourceContent(i,o)}),n};x.prototype.addMapping=function(e){var t=S.getArg(e,"generated"),n=S.getArg(e,"original",null),i=S.getArg(e,"source",null),s=S.getArg(e,"name",null);this._skipValidation||this._validateMapping(t,n,i,s),i!=null&&(i=String(i),this._sources.has(i)||this._sources.add(i)),s!=null&&(s=String(s),this._names.has(s)||this._names.add(s)),this._mappings.add({generatedLine:t.line,generatedColumn:t.column,originalLine:n!=null&&n.line,originalColumn:n!=null&&n.column,source:i,name:s})};x.prototype.setSourceContent=function(e,t){var n=e;this._sourceRoot!=null&&(n=S.relative(this._sourceRoot,n)),t!=null?(this._sourcesContents||(this._sourcesContents=Object.create(null)),this._sourcesContents[S.toSetString(n)]=t):this._sourcesContents&&(delete this._sourcesContents[S.toSetString(n)],Object.keys(this._sourcesContents).length===0&&(this._sourcesContents=null))};x.prototype.applySourceMap=function(e,t,n){var i=t;if(t==null){if(e.file==null)throw new Error(`SourceMapGenerator.prototype.applySourceMap requires either an explicit source file, or the source map's "file" property. Both were omitted.`);i=e.file}var s=this._sourceRoot;s!=null&&(i=S.relative(s,i));var o=new ae,l=new ae;this._mappings.unsortedForEach(function(a){if(a.source===i&&a.originalLine!=null){var m=e.originalPositionFor({line:a.originalLine,column:a.originalColumn});m.source!=null&&(a.source=m.source,n!=null&&(a.source=S.join(n,a.source)),s!=null&&(a.source=S.relative(s,a.source)),a.originalLine=m.line,a.originalColumn=m.column,m.name!=null&&(a.name=m.name))}var u=a.source;u!=null&&!o.has(u)&&o.add(u);var h=a.name;h!=null&&!l.has(h)&&l.add(h)},this),this._sources=o,this._names=l,e.sources.forEach(function(a){var m=e.sourceContentFor(a);m!=null&&(n!=null&&(a=S.join(n,a)),s!=null&&(a=S.relative(s,a)),this.setSourceContent(a,m))},this)};x.prototype._validateMapping=function(e,t,n,i){if(t&&typeof t.line!="number"&&typeof t.column!="number")throw new Error("original.line and original.column are not numbers -- you probably meant to omit the original mapping entirely and only map the generated position. If so, pass null for the original mapping instead of an object with empty or null values.");if(!(e&&"line"in e&&"column"in e&&e.line>0&&e.column>=0&&!t&&!n&&!i)){if(e&&"line"in e&&"column"in e&&t&&"line"in t&&"column"in t&&e.line>0&&e.column>=0&&t.line>0&&t.column>=0&&n)return;throw new Error("Invalid mapping: "+JSON.stringify({generated:e,source:n,original:t,name:i}))}};x.prototype._serializeMappings=function(){for(var e=0,t=1,n=0,i=0,s=0,o=0,l="",a,m,u,h,c=this._mappings.toArray(),d=0,g=c.length;d<g;d++){if(m=c[d],a="",m.generatedLine!==t)for(e=0;m.generatedLine!==t;)a+=";",t++;else if(d>0){if(!S.compareByGeneratedPositionsInflated(m,c[d-1]))continue;a+=","}a+=ee.encode(m.generatedColumn-e),e=m.generatedColumn,m.source!=null&&(h=this._sources.indexOf(m.source),a+=ee.encode(h-o),o=h,a+=ee.encode(m.originalLine-1-i),i=m.originalLine-1,a+=ee.encode(m.originalColumn-n),n=m.originalColumn,m.name!=null&&(u=this._names.indexOf(m.name),a+=ee.encode(u-s),s=u)),l+=a}return l};x.prototype._generateSourcesContent=function(e,t){return e.map(function(n){if(!this._sourcesContents)return null;t!=null&&(n=S.relative(t,n));var i=S.toSetString(n);return Object.prototype.hasOwnProperty.call(this._sourcesContents,i)?this._sourcesContents[i]:null},this)};x.prototype.toJSON=function(){var e={version:this._version,sources:this._sources.toArray(),names:this._names.toArray(),mappings:this._serializeMappings()};return this._file!=null&&(e.file=this._file),this._sourceRoot!=null&&(e.sourceRoot=this._sourceRoot),this._sourcesContents&&(e.sourcesContent=this._generateSourcesContent(e.sources,e.sourceRoot)),e};x.prototype.toString=function(){return JSON.stringify(this.toJSON())};Mt.SourceMapGenerator=x});var Lt=v(j=>{j.GREATEST_LOWER_BOUND=1;j.LEAST_UPPER_BOUND=2;function Ee(r,e,t,n,i,s){var o=Math.floor((e-r)/2)+r,l=i(t,n[o],!0);return l===0?o:l>0?e-o>1?Ee(o,e,t,n,i,s):s==j.LEAST_UPPER_BOUND?e<n.length?e:-1:o:o-r>1?Ee(r,o,t,n,i,s):s==j.LEAST_UPPER_BOUND?o:r<0?-1:r}j.search=function(e,t,n,i){if(t.length===0)return-1;var s=Ee(-1,t.length,e,t,n,i||j.GREATEST_LOWER_BOUND);if(s<0)return-1;for(;s-1>=0&&n(t[s],t[s-1],!0)===0;)--s;return s}});var $t=v(Nt=>{function Oe(r,e,t){var n=r[e];r[e]=r[t],r[t]=n}function Ln(r,e){return Math.round(r+Math.random()*(e-r))}function xe(r,e,t,n){if(t<n){var i=Ln(t,n),s=t-1;Oe(r,i,n);for(var o=r[n],l=t;l<n;l++)e(r[l],o)<=0&&(s+=1,Oe(r,s,l));Oe(r,s+1,l);var a=s+1;xe(r,e,t,a-1),xe(r,e,a+1,n)}}Nt.quickSort=function(r,e){xe(r,e,0,r.length-1)}});var It=v(me=>{var f=z(),ke=Lt(),J=be().ArraySet,Nn=ye(),te=$t().quickSort;function w(r,e){var t=r;return typeof r=="string"&&(t=f.parseSourceMapInput(r)),t.sections!=null?new M(t,e):new b(t,e)}w.fromSourceMap=function(r,e){return b.fromSourceMap(r,e)};w.prototype._version=3;w.prototype.__generatedMappings=null;Object.defineProperty(w.prototype,"_generatedMappings",{configurable:!0,enumerable:!0,get:function(){return this.__generatedMappings||this._parseMappings(this._mappings,this.sourceRoot),this.__generatedMappings}});w.prototype.__originalMappings=null;Object.defineProperty(w.prototype,"_originalMappings",{configurable:!0,enumerable:!0,get:function(){return this.__originalMappings||this._parseMappings(this._mappings,this.sourceRoot),this.__originalMappings}});w.prototype._charIsMappingSeparator=function(e,t){var n=e.charAt(t);return n===";"||n===","};w.prototype._parseMappings=function(e,t){throw new Error("Subclasses must implement _parseMappings")};w.GENERATED_ORDER=1;w.ORIGINAL_ORDER=2;w.GREATEST_LOWER_BOUND=1;w.LEAST_UPPER_BOUND=2;w.prototype.eachMapping=function(e,t,n){var i=t||null,s=n||w.GENERATED_ORDER,o;switch(s){case w.GENERATED_ORDER:o=this._generatedMappings;break;case w.ORIGINAL_ORDER:o=this._originalMappings;break;default:throw new Error("Unknown order of iteration.")}var l=this.sourceRoot;o.map(function(a){var m=a.source===null?null:this._sources.at(a.source);return m=f.computeSourceURL(l,m,this._sourceMapURL),{source:m,generatedLine:a.generatedLine,generatedColumn:a.generatedColumn,originalLine:a.originalLine,originalColumn:a.originalColumn,name:a.name===null?null:this._names.at(a.name)}},this).forEach(e,i)};w.prototype.allGeneratedPositionsFor=function(e){var t=f.getArg(e,"line"),n={source:f.getArg(e,"source"),originalLine:t,originalColumn:f.getArg(e,"column",0)};if(n.source=this._findSourceIndex(n.source),n.source<0)return[];var i=[],s=this._findMapping(n,this._originalMappings,"originalLine","originalColumn",f.compareByOriginalPositions,ke.LEAST_UPPER_BOUND);if(s>=0){var o=this._originalMappings[s];if(e.column===void 0)for(var l=o.originalLine;o&&o.originalLine===l;)i.push({line:f.getArg(o,"generatedLine",null),column:f.getArg(o,"generatedColumn",null),lastColumn:f.getArg(o,"lastGeneratedColumn",null)}),o=this._originalMappings[++s];else for(var a=o.originalColumn;o&&o.originalLine===t&&o.originalColumn==a;)i.push({line:f.getArg(o,"generatedLine",null),column:f.getArg(o,"generatedColumn",null),lastColumn:f.getArg(o,"lastGeneratedColumn",null)}),o=this._originalMappings[++s]}return i};me.SourceMapConsumer=w;function b(r,e){var t=r;typeof r=="string"&&(t=f.parseSourceMapInput(r));var n=f.getArg(t,"version"),i=f.getArg(t,"sources"),s=f.getArg(t,"names",[]),o=f.getArg(t,"sourceRoot",null),l=f.getArg(t,"sourcesContent",null),a=f.getArg(t,"mappings"),m=f.getArg(t,"file",null);if(n!=this._version)throw new Error("Unsupported version: "+n);o&&(o=f.normalize(o)),i=i.map(String).map(f.normalize).map(function(u){return o&&f.isAbsolute(o)&&f.isAbsolute(u)?f.relative(o,u):u}),this._names=J.fromArray(s.map(String),!0),this._sources=J.fromArray(i,!0),this._absoluteSources=this._sources.toArray().map(function(u){return f.computeSourceURL(o,u,e)}),this.sourceRoot=o,this.sourcesContent=l,this._mappings=a,this._sourceMapURL=e,this.file=m}b.prototype=Object.create(w.prototype);b.prototype.consumer=w;b.prototype._findSourceIndex=function(r){var e=r;if(this.sourceRoot!=null&&(e=f.relative(this.sourceRoot,e)),this._sources.has(e))return this._sources.indexOf(e);var t;for(t=0;t<this._absoluteSources.length;++t)if(this._absoluteSources[t]==r)return t;return-1};b.fromSourceMap=function(e,t){var n=Object.create(b.prototype),i=n._names=J.fromArray(e._names.toArray(),!0),s=n._sources=J.fromArray(e._sources.toArray(),!0);n.sourceRoot=e._sourceRoot,n.sourcesContent=e._generateSourcesContent(n._sources.toArray(),n.sourceRoot),n.file=e._file,n._sourceMapURL=t,n._absoluteSources=n._sources.toArray().map(function(d){return f.computeSourceURL(n.sourceRoot,d,t)});for(var o=e._mappings.toArray().slice(),l=n.__generatedMappings=[],a=n.__originalMappings=[],m=0,u=o.length;m<u;m++){var h=o[m],c=new Pt;c.generatedLine=h.generatedLine,c.generatedColumn=h.generatedColumn,h.source&&(c.source=s.indexOf(h.source),c.originalLine=h.originalLine,c.originalColumn=h.originalColumn,h.name&&(c.name=i.indexOf(h.name)),a.push(c)),l.push(c)}return te(n.__originalMappings,f.compareByOriginalPositions),n};b.prototype._version=3;Object.defineProperty(b.prototype,"sources",{get:function(){return this._absoluteSources.slice()}});function Pt(){this.generatedLine=0,this.generatedColumn=0,this.source=null,this.originalLine=null,this.originalColumn=null,this.name=null}b.prototype._parseMappings=function(e,t){for(var n=1,i=0,s=0,o=0,l=0,a=0,m=e.length,u=0,h={},c={},d=[],g=[],y,L,A,G,ht;u<m;)if(e.charAt(u)===";")n++,u++,i=0;else if(e.charAt(u)===",")u++;else{for(y=new Pt,y.generatedLine=n,G=u;G<m&&!this._charIsMappingSeparator(e,G);G++);if(L=e.slice(u,G),A=h[L],A)u+=L.length;else{for(A=[];u<G;)Nn.decode(e,u,c),ht=c.value,u=c.rest,A.push(ht);if(A.length===2)throw new Error("Found a source, but no line and column");if(A.length===3)throw new Error("Found a source and line, but no column");h[L]=A}y.generatedColumn=i+A[0],i=y.generatedColumn,A.length>1&&(y.source=l+A[1],l+=A[1],y.originalLine=s+A[2],s=y.originalLine,y.originalLine+=1,y.originalColumn=o+A[3],o=y.originalColumn,A.length>4&&(y.name=a+A[4],a+=A[4])),g.push(y),typeof y.originalLine=="number"&&d.push(y)}te(g,f.compareByGeneratedPositionsDeflated),this.__generatedMappings=g,te(d,f.compareByOriginalPositions),this.__originalMappings=d};b.prototype._findMapping=function(e,t,n,i,s,o){if(e[n]<=0)throw new TypeError("Line must be greater than or equal to 1, got "+e[n]);if(e[i]<0)throw new TypeError("Column must be greater than or equal to 0, got "+e[i]);return ke.search(e,t,s,o)};b.prototype.computeColumnSpans=function(){for(var e=0;e<this._generatedMappings.length;++e){var t=this._generatedMappings[e];if(e+1<this._generatedMappings.length){var n=this._generatedMappings[e+1];if(t.generatedLine===n.generatedLine){t.lastGeneratedColumn=n.generatedColumn-1;continue}}t.lastGeneratedColumn=1/0}};b.prototype.originalPositionFor=function(e){var t={generatedLine:f.getArg(e,"line"),generatedColumn:f.getArg(e,"column")},n=this._findMapping(t,this._generatedMappings,"generatedLine","generatedColumn",f.compareByGeneratedPositionsDeflated,f.getArg(e,"bias",w.GREATEST_LOWER_BOUND));if(n>=0){var i=this._generatedMappings[n];if(i.generatedLine===t.generatedLine){var s=f.getArg(i,"source",null);s!==null&&(s=this._sources.at(s),s=f.computeSourceURL(this.sourceRoot,s,this._sourceMapURL));var o=f.getArg(i,"name",null);return o!==null&&(o=this._names.at(o)),{source:s,line:f.getArg(i,"originalLine",null),column:f.getArg(i,"originalColumn",null),name:o}}}return{source:null,line:null,column:null,name:null}};b.prototype.hasContentsOfAllSources=function(){return this.sourcesContent?this.sourcesContent.length>=this._sources.size()&&!this.sourcesContent.some(function(e){return e==null}):!1};b.prototype.sourceContentFor=function(e,t){if(!this.sourcesContent)return null;var n=this._findSourceIndex(e);if(n>=0)return this.sourcesContent[n];var i=e;this.sourceRoot!=null&&(i=f.relative(this.sourceRoot,i));var s;if(this.sourceRoot!=null&&(s=f.urlParse(this.sourceRoot))){var o=i.replace(/^file:\/\//,"");if(s.scheme=="file"&&this._sources.has(o))return this.sourcesContent[this._sources.indexOf(o)];if((!s.path||s.path=="/")&&this._sources.has("/"+i))return this.sourcesContent[this._sources.indexOf("/"+i)]}if(t)return null;throw new Error('"'+i+'" is not in the SourceMap.')};b.prototype.generatedPositionFor=function(e){var t=f.getArg(e,"source");if(t=this._findSourceIndex(t),t<0)return{line:null,column:null,lastColumn:null};var n={source:t,originalLine:f.getArg(e,"line"),originalColumn:f.getArg(e,"column")},i=this._findMapping(n,this._originalMappings,"originalLine","originalColumn",f.compareByOriginalPositions,f.getArg(e,"bias",w.GREATEST_LOWER_BOUND));if(i>=0){var s=this._originalMappings[i];if(s.source===n.source)return{line:f.getArg(s,"generatedLine",null),column:f.getArg(s,"generatedColumn",null),lastColumn:f.getArg(s,"lastGeneratedColumn",null)}}return{line:null,column:null,lastColumn:null}};me.BasicSourceMapConsumer=b;function M(r,e){var t=r;typeof r=="string"&&(t=f.parseSourceMapInput(r));var n=f.getArg(t,"version"),i=f.getArg(t,"sections");if(n!=this._version)throw new Error("Unsupported version: "+n);this._sources=new J,this._names=new J;var s={line:-1,column:0};this._sections=i.map(function(o){if(o.url)throw new Error("Support for url field in sections not implemented.");var l=f.getArg(o,"offset"),a=f.getArg(l,"line"),m=f.getArg(l,"column");if(a<s.line||a===s.line&&m<s.column)throw new Error("Section offsets must be ordered and non-overlapping.");return s=l,{generatedOffset:{generatedLine:a+1,generatedColumn:m+1},consumer:new w(f.getArg(o,"map"),e)}})}M.prototype=Object.create(w.prototype);M.prototype.constructor=w;M.prototype._version=3;Object.defineProperty(M.prototype,"sources",{get:function(){for(var r=[],e=0;e<this._sections.length;e++)for(var t=0;t<this._sections[e].consumer.sources.length;t++)r.push(this._sections[e].consumer.sources[t]);return r}});M.prototype.originalPositionFor=function(e){var t={generatedLine:f.getArg(e,"line"),generatedColumn:f.getArg(e,"column")},n=ke.search(t,this._sections,function(s,o){var l=s.generatedLine-o.generatedOffset.generatedLine;return l||s.generatedColumn-o.generatedOffset.generatedColumn}),i=this._sections[n];return i?i.consumer.originalPositionFor({line:t.generatedLine-(i.generatedOffset.generatedLine-1),column:t.generatedColumn-(i.generatedOffset.generatedLine===t.generatedLine?i.generatedOffset.generatedColumn-1:0),bias:e.bias}):{source:null,line:null,column:null,name:null}};M.prototype.hasContentsOfAllSources=function(){return this._sections.every(function(e){return e.consumer.hasContentsOfAllSources()})};M.prototype.sourceContentFor=function(e,t){for(var n=0;n<this._sections.length;n++){var i=this._sections[n],s=i.consumer.sourceContentFor(e,!0);if(s)return s}if(t)return null;throw new Error('"'+e+'" is not in the SourceMap.')};M.prototype.generatedPositionFor=function(e){for(var t=0;t<this._sections.length;t++){var n=this._sections[t];if(n.consumer._findSourceIndex(f.getArg(e,"source"))!==-1){var i=n.consumer.generatedPositionFor(e);if(i){var s={line:i.line+(n.generatedOffset.generatedLine-1),column:i.column+(n.generatedOffset.generatedLine===i.line?n.generatedOffset.generatedColumn-1:0)};return s}}}return{line:null,column:null}};M.prototype._parseMappings=function(e,t){this.__generatedMappings=[],this.__originalMappings=[];for(var n=0;n<this._sections.length;n++)for(var i=this._sections[n],s=i.consumer._generatedMappings,o=0;o<s.length;o++){var l=s[o],a=i.consumer._sources.at(l.source);a=f.computeSourceURL(i.consumer.sourceRoot,a,this._sourceMapURL),this._sources.add(a),a=this._sources.indexOf(a);var m=null;l.name&&(m=i.consumer._names.at(l.name),this._names.add(m),m=this._names.indexOf(m));var u={source:a,generatedLine:l.generatedLine+(i.generatedOffset.generatedLine-1),generatedColumn:l.generatedColumn+(i.generatedOffset.generatedLine===l.generatedLine?i.generatedOffset.generatedColumn-1:0),originalLine:l.originalLine,originalColumn:l.originalColumn,name:m};this.__generatedMappings.push(u),typeof u.originalLine=="number"&&this.__originalMappings.push(u)}te(this.__generatedMappings,f.compareByGeneratedPositionsDeflated),te(this.__originalMappings,f.compareByOriginalPositions)};me.IndexedSourceMapConsumer=M});var Vt=v(Rt=>{var $n=Ae().SourceMapGenerator,le=z(),Pn=/(\r?\n)/,In=10,K="$$$isSourceNode$$$";function O(r,e,t,n,i){this.children=[],this.sourceContents={},this.line=r??null,this.column=e??null,this.source=t??null,this.name=i??null,this[K]=!0,n!=null&&this.add(n)}O.fromStringWithSourceMap=function(e,t,n){var i=new O,s=e.split(Pn),o=0,l=function(){var c=g(),d=g()||"";return c+d;function g(){return o<s.length?s[o++]:void 0}},a=1,m=0,u=null;return t.eachMapping(function(c){if(u!==null)if(a<c.generatedLine)h(u,l()),a++,m=0;else{var d=s[o]||"",g=d.substr(0,c.generatedColumn-m);s[o]=d.substr(c.generatedColumn-m),m=c.generatedColumn,h(u,g),u=c;return}for(;a<c.generatedLine;)i.add(l()),a++;if(m<c.generatedColumn){var d=s[o]||"";i.add(d.substr(0,c.generatedColumn)),s[o]=d.substr(c.generatedColumn),m=c.generatedColumn}u=c},this),o<s.length&&(u&&h(u,l()),i.add(s.splice(o).join(""))),t.sources.forEach(function(c){var d=t.sourceContentFor(c);d!=null&&(n!=null&&(c=le.join(n,c)),i.setSourceContent(c,d))}),i;function h(c,d){if(c===null||c.source===void 0)i.add(d);else{var g=n?le.join(n,c.source):c.source;i.add(new O(c.originalLine,c.originalColumn,g,d,c.name))}}};O.prototype.add=function(e){if(Array.isArray(e))e.forEach(function(t){this.add(t)},this);else if(e[K]||typeof e=="string")e&&this.children.push(e);else throw new TypeError("Expected a SourceNode, string, or an array of SourceNodes and strings. Got "+e);return this};O.prototype.prepend=function(e){if(Array.isArray(e))for(var t=e.length-1;t>=0;t--)this.prepend(e[t]);else if(e[K]||typeof e=="string")this.children.unshift(e);else throw new TypeError("Expected a SourceNode, string, or an array of SourceNodes and strings. Got "+e);return this};O.prototype.walk=function(e){for(var t,n=0,i=this.children.length;n<i;n++)t=this.children[n],t[K]?t.walk(e):t!==""&&e(t,{source:this.source,line:this.line,column:this.column,name:this.name})};O.prototype.join=function(e){var t,n,i=this.children.length;if(i>0){for(t=[],n=0;n<i-1;n++)t.push(this.children[n]),t.push(e);t.push(this.children[n]),this.children=t}return this};O.prototype.replaceRight=function(e,t){var n=this.children[this.children.length-1];return n[K]?n.replaceRight(e,t):typeof n=="string"?this.children[this.children.length-1]=n.replace(e,t):this.children.push("".replace(e,t)),this};O.prototype.setSourceContent=function(e,t){this.sourceContents[le.toSetString(e)]=t};O.prototype.walkSourceContents=function(e){for(var t=0,n=this.children.length;t<n;t++)this.children[t][K]&&this.children[t].walkSourceContents(e);for(var i=Object.keys(this.sourceContents),t=0,n=i.length;t<n;t++)e(le.fromSetString(i[t]),this.sourceContents[i[t]])};O.prototype.toString=function(){var e="";return this.walk(function(t){e+=t}),e};O.prototype.toStringWithSourceMap=function(e){var t={code:"",line:1,column:0},n=new $n(e),i=!1,s=null,o=null,l=null,a=null;return this.walk(function(m,u){t.code+=m,u.source!==null&&u.line!==null&&u.column!==null?((s!==u.source||o!==u.line||l!==u.column||a!==u.name)&&n.addMapping({source:u.source,original:{line:u.line,column:u.column},generated:{line:t.line,column:t.column},name:u.name}),s=u.source,o=u.line,l=u.column,a=u.name,i=!0):i&&(n.addMapping({generated:{line:t.line,column:t.column}}),s=null,i=!1);for(var h=0,c=m.length;h<c;h++)m.charCodeAt(h)===In?(t.line++,t.column=0,h+1===c?(s=null,i=!1):i&&n.addMapping({source:u.source,original:{line:u.line,column:u.column},generated:{line:t.line,column:t.column},name:u.name})):t.column++}),this.walkSourceContents(function(m,u){n.setSourceContent(m,u)}),{code:t.code,map:n}};Rt.SourceNode=O});var Tt=v(ue=>{ue.SourceMapGenerator=Ae().SourceMapGenerator;ue.SourceMapConsumer=It().SourceMapConsumer;ue.SourceNode=Vt().SourceNode});var Dt=v((fs,jt)=>{var Rn=Object.prototype.toString,Me=typeof Buffer<"u"&&typeof Buffer.alloc=="function"&&typeof Buffer.allocUnsafe=="function"&&typeof Buffer.from=="function";function Vn(r){return Rn.call(r).slice(8,-1)==="ArrayBuffer"}function Tn(r,e,t){e>>>=0;var n=r.byteLength-e;if(n<0)throw new RangeError("'offset' is out of bounds");if(t===void 0)t=n;else if(t>>>=0,t>n)throw new RangeError("'length' is out of bounds");return Me?Buffer.from(r.slice(e,e+t)):new Buffer(new Uint8Array(r.slice(e,e+t)))}function jn(r,e){if((typeof e!="string"||e==="")&&(e="utf8"),!Buffer.isEncoding(e))throw new TypeError('"encoding" must be a valid string encoding');return Me?Buffer.from(r,e):new Buffer(r,e)}function Dn(r,e,t){if(typeof r=="number")throw new TypeError('"value" argument must not be a number');return Vn(r)?Tn(r,e,t):typeof r=="string"?jn(r,e):Me?Buffer.from(r):new Buffer(r)}jt.exports=Dn});var zt=v((q,Pe)=>{var qn=Tt().SourceMapConsumer,Le=require("path"),N;try{N=require("fs"),(!N.existsSync||!N.readFileSync)&&(N=null)}catch{}var Hn=Dt();function qt(r,e){return r.require(e)}var Ht=!1,Ft=!1,Ne=!1,re="auto",D={},ne={},Fn=/^data:application\/json[^,]+base64,/,I=[],R=[];function Ie(){return re==="browser"?!0:re==="node"?!1:typeof window<"u"&&typeof XMLHttpRequest=="function"&&!(window.require&&window.module&&window.process&&window.process.type==="renderer")}function Gn(){return typeof process=="object"&&process!==null&&typeof process.on=="function"}function Un(){return typeof process=="object"&&process!==null?process.version:""}function Bn(){if(typeof process=="object"&&process!==null)return process.stderr}function Wn(r){if(typeof process=="object"&&process!==null&&typeof process.exit=="function")return process.exit(r)}function ce(r){return function(e){for(var t=0;t<r.length;t++){var n=r[t](e);if(n)return n}return null}}var Re=ce(I);I.push(function(r){if(r=r.trim(),/^file:/.test(r)&&(r=r.replace(/file:\/\/\/(\w:)?/,function(n,i){return i?"":"/"})),r in D)return D[r];var e="";try{if(N)N.existsSync(r)&&(e=N.readFileSync(r,"utf8"));else{var t=new XMLHttpRequest;t.open("GET",r,!1),t.send(null),t.readyState===4&&t.status===200&&(e=t.responseText)}}catch{}return D[r]=e});function $e(r,e){if(!r)return e;var t=Le.dirname(r),n=/^\w+:\/\/[^\/]*/.exec(t),i=n?n[0]:"",s=t.slice(i.length);return i&&/^\/\w\:/.test(s)?(i+="/",i+Le.resolve(t.slice(i.length),e).replace(/\\/g,"/")):i+Le.resolve(t.slice(i.length),e)}function zn(r){var e;if(Ie())try{var t=new XMLHttpRequest;t.open("GET",r,!1),t.send(null),e=t.readyState===4?t.responseText:null;var n=t.getResponseHeader("SourceMap")||t.getResponseHeader("X-SourceMap");if(n)return n}catch{}e=Re(r);for(var i=/(?:\/\/[@#][\s]*sourceMappingURL=([^\s'"]+)[\s]*$)|(?:\/\*[@#][\s]*sourceMappingURL=([^\s*'"]+)[\s]*(?:\*\/)[\s]*$)/mg,s,o;o=i.exec(e);)s=o;return s?s[1]:null}var Ve=ce(R);R.push(function(r){var e=zn(r);if(!e)return null;var t;if(Fn.test(e)){var n=e.slice(e.indexOf(",")+1);t=Hn(n,"base64").toString(),e=r}else e=$e(r,e),t=Re(e);return t?{url:e,map:t}:null});function Te(r){var e=ne[r.source];if(!e){var t=Ve(r.source);t?(e=ne[r.source]={url:t.url,map:new qn(t.map)},e.map.sourcesContent&&e.map.sources.forEach(function(i,s){var o=e.map.sourcesContent[s];if(o){var l=$e(e.url,i);D[l]=o}})):e=ne[r.source]={url:null,map:null}}if(e&&e.map&&typeof e.map.originalPositionFor=="function"){var n=e.map.originalPositionFor(r);if(n.source!==null)return n.source=$e(e.url,n.source),n}return r}function Ut(r){var e=/^eval at ([^(]+) \((.+):(\d+):(\d+)\)$/.exec(r);if(e){var t=Te({source:e[2],line:+e[3],column:e[4]-1});return"eval at "+e[1]+" ("+t.source+":"+t.line+":"+(t.column+1)+")"}return e=/^eval at ([^(]+) \((.+)\)$/.exec(r),e?"eval at "+e[1]+" ("+Ut(e[2])+")":r}function Jn(){var r,e="";if(this.isNative())e="native";else{r=this.getScriptNameOrSourceURL(),!r&&this.isEval()&&(e=this.getEvalOrigin(),e+=", "),r?e+=r:e+="<anonymous>";var t=this.getLineNumber();if(t!=null){e+=":"+t;var n=this.getColumnNumber();n&&(e+=":"+n)}}var i="",s=this.getFunctionName(),o=!0,l=this.isConstructor(),a=!(this.isToplevel()||l);if(a){var m=this.getTypeName();m==="[object Object]"&&(m="null");var u=this.getMethodName();s?(m&&s.indexOf(m)!=0&&(i+=m+"."),i+=s,u&&s.indexOf("."+u)!=s.length-u.length-1&&(i+=" [as "+u+"]")):i+=m+"."+(u||"<anonymous>")}else l?i+="new "+(s||"<anonymous>"):s?i+=s:(i+=e,o=!1);return o&&(i+=" ("+e+")"),i}function Gt(r){var e={};return Object.getOwnPropertyNames(Object.getPrototypeOf(r)).forEach(function(t){e[t]=/^(?:is|get)/.test(t)?function(){return r[t].call(r)}:r[t]}),e.toString=Jn,e}function Bt(r,e){if(e===void 0&&(e={nextPosition:null,curPosition:null}),r.isNative())return e.curPosition=null,r;var t=r.getFileName()||r.getScriptNameOrSourceURL();if(t){var n=r.getLineNumber(),i=r.getColumnNumber()-1,s=/^v(10\.1[6-9]|10\.[2-9][0-9]|10\.[0-9]{3,}|1[2-9]\d*|[2-9]\d|\d{3,}|11\.11)/,o=s.test(Un())?0:62;n===1&&i>o&&!Ie()&&!r.isEval()&&(i-=o);var l=Te({source:t,line:n,column:i});e.curPosition=l,r=Gt(r);var a=r.getFunctionName;return r.getFunctionName=function(){return e.nextPosition==null?a():e.nextPosition.name||a()},r.getFileName=function(){return l.source},r.getLineNumber=function(){return l.line},r.getColumnNumber=function(){return l.column+1},r.getScriptNameOrSourceURL=function(){return l.source},r}var m=r.isEval()&&r.getEvalOrigin();return m&&(m=Ut(m),r=Gt(r),r.getEvalOrigin=function(){return m}),r}function Kn(r,e){Ne&&(D={},ne={});for(var t=r.name||"Error",n=r.message||"",i=t+": "+n,s={nextPosition:null,curPosition:null},o=[],l=e.length-1;l>=0;l--)o.push(`
|
|
3
|
+
at `+Bt(e[l],s)),s.nextPosition=s.curPosition;return s.curPosition=s.nextPosition=null,i+o.reverse().join("")}function Wt(r){var e=/\n at [^(]+ \((.*):(\d+):(\d+)\)/.exec(r.stack);if(e){var t=e[1],n=+e[2],i=+e[3],s=D[t];if(!s&&N&&N.existsSync(t))try{s=N.readFileSync(t,"utf8")}catch{s=""}if(s){var o=s.split(/(?:\r\n|\r|\n)/)[n-1];if(o)return t+":"+n+`
|
|
4
|
+
`+o+`
|
|
5
|
+
`+new Array(i).join(" ")+"^"}}return null}function Qn(r){var e=Wt(r),t=Bn();t&&t._handle&&t._handle.setBlocking&&t._handle.setBlocking(!0),e&&(console.error(),console.error(e)),console.error(r.stack),Wn(1)}function Xn(){var r=process.emit;process.emit=function(e){if(e==="uncaughtException"){var t=arguments[1]&&arguments[1].stack,n=this.listeners(e).length>0;if(t&&!n)return Qn(arguments[1])}return r.apply(this,arguments)}}var Yn=I.slice(0),Zn=R.slice(0);q.wrapCallSite=Bt;q.getErrorSource=Wt;q.mapSourcePosition=Te;q.retrieveSourceMap=Ve;q.install=function(r){if(r=r||{},r.environment&&(re=r.environment,["node","browser","auto"].indexOf(re)===-1))throw new Error("environment "+re+" was unknown. Available options are {auto, browser, node}");if(r.retrieveFile&&(r.overrideRetrieveFile&&(I.length=0),I.unshift(r.retrieveFile)),r.retrieveSourceMap&&(r.overrideRetrieveSourceMap&&(R.length=0),R.unshift(r.retrieveSourceMap)),r.hookRequire&&!Ie()){var e=qt(Pe,"module"),t=e.prototype._compile;t.__sourceMapSupport||(e.prototype._compile=function(s,o){return D[o]=s,ne[o]=void 0,t.call(this,s,o)},e.prototype._compile.__sourceMapSupport=!0)}if(Ne||(Ne="emptyCacheBetweenOperations"in r?r.emptyCacheBetweenOperations:!1),Ht||(Ht=!0,Error.prepareStackTrace=Kn),!Ft){var n="handleUncaughtExceptions"in r?r.handleUncaughtExceptions:!0;try{var i=qt(Pe,"worker_threads");i.isMainThread===!1&&(n=!1)}catch{}n&&Gn()&&(Ft=!0,Xn())}};q.resetRetrieveHandlers=function(){I.length=0,R.length=0,I=Yn.slice(0),R=Zn.slice(0),Ve=ce(R),Re=ce(I)}});var ie=v(De=>{var he=class extends Error{constructor(e,t,n){super(n),Error.captureStackTrace(this,this.constructor),this.name=this.constructor.name,this.code=t,this.exitCode=e,this.nestedError=void 0}},je=class extends he{constructor(e){super(1,"commander.invalidArgument",e),Error.captureStackTrace(this,this.constructor),this.name=this.constructor.name}};De.CommanderError=he;De.InvalidArgumentError=je});var fe=v(He=>{var{InvalidArgumentError:ei}=ie(),qe=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._name=e.slice(1,-1);break;case"[":this.required=!1,this._name=e.slice(1,-1);break;default:this.required=!0,this._name=e;break}this._name.length>3&&this._name.slice(-3)==="..."&&(this.variadic=!0,this._name=this._name.slice(0,-3))}name(){return this._name}_concatValue(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,n)=>{if(!this.argChoices.includes(t))throw new ei(`Allowed choices are ${this.argChoices.join(", ")}.`);return this.variadic?this._concatValue(t,n):t},this}argRequired(){return this.required=!0,this}argOptional(){return this.required=!1,this}};function ti(r){let e=r.name()+(r.variadic===!0?"...":"");return r.required?"<"+e+">":"["+e+"]"}He.Argument=qe;He.humanReadableArgName=ti});var Ge=v(Jt=>{var{humanReadableArgName:ri}=fe(),Fe=class{constructor(){this.helpWidth=void 0,this.sortSubcommands=!1,this.sortOptions=!1,this.showGlobalOptions=!1}visibleCommands(e){let t=e.commands.filter(i=>!i._hidden),n=e._getHelpCommand();return n&&!n._hidden&&t.push(n),this.sortSubcommands&&t.sort((i,s)=>i.name().localeCompare(s.name())),t}compareOptions(e,t){let n=i=>i.short?i.short.replace(/^-/,""):i.long.replace(/^--/,"");return n(e).localeCompare(n(t))}visibleOptions(e){let t=e.options.filter(i=>!i.hidden),n=e._getHelpOption();if(n&&!n.hidden){let i=n.short&&e._findOption(n.short),s=n.long&&e._findOption(n.long);!i&&!s?t.push(n):n.long&&!s?t.push(e.createOption(n.long,n.description)):n.short&&!i&&t.push(e.createOption(n.short,n.description))}return this.sortOptions&&t.sort(this.compareOptions),t}visibleGlobalOptions(e){if(!this.showGlobalOptions)return[];let t=[];for(let n=e.parent;n;n=n.parent){let i=n.options.filter(s=>!s.hidden);t.push(...i)}return this.sortOptions&&t.sort(this.compareOptions),t}visibleArguments(e){return e._argsDescription&&e.registeredArguments.forEach(t=>{t.description=t.description||e._argsDescription[t.name()]||""}),e.registeredArguments.find(t=>t.description)?e.registeredArguments:[]}subcommandTerm(e){let t=e.registeredArguments.map(n=>ri(n)).join(" ");return e._name+(e._aliases[0]?"|"+e._aliases[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((n,i)=>Math.max(n,t.subcommandTerm(i).length),0)}longestOptionTermLength(e,t){return t.visibleOptions(e).reduce((n,i)=>Math.max(n,t.optionTerm(i).length),0)}longestGlobalOptionTermLength(e,t){return t.visibleGlobalOptions(e).reduce((n,i)=>Math.max(n,t.optionTerm(i).length),0)}longestArgumentTermLength(e,t){return t.visibleArguments(e).reduce((n,i)=>Math.max(n,t.argumentTerm(i).length),0)}commandUsage(e){let t=e._name;e._aliases[0]&&(t=t+"|"+e._aliases[0]);let n="";for(let i=e.parent;i;i=i.parent)n=i.name()+" "+n;return n+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(n=>JSON.stringify(n)).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(n=>JSON.stringify(n)).join(", ")}`),e.defaultValue!==void 0&&t.push(`default: ${e.defaultValueDescription||JSON.stringify(e.defaultValue)}`),t.length>0){let n=`(${t.join(", ")})`;return e.description?`${e.description} ${n}`:n}return e.description}formatHelp(e,t){let n=t.padWidth(e,t),i=t.helpWidth||80,s=2,o=2;function l(g,y){if(y){let L=`${g.padEnd(n+o)}${y}`;return t.wrap(L,i-s,n+o)}return g}function a(g){return g.join(`
|
|
6
|
+
`).replace(/^/gm," ".repeat(s))}let m=[`Usage: ${t.commandUsage(e)}`,""],u=t.commandDescription(e);u.length>0&&(m=m.concat([t.wrap(u,i,0),""]));let h=t.visibleArguments(e).map(g=>l(t.argumentTerm(g),t.argumentDescription(g)));h.length>0&&(m=m.concat(["Arguments:",a(h),""]));let c=t.visibleOptions(e).map(g=>l(t.optionTerm(g),t.optionDescription(g)));if(c.length>0&&(m=m.concat(["Options:",a(c),""])),this.showGlobalOptions){let g=t.visibleGlobalOptions(e).map(y=>l(t.optionTerm(y),t.optionDescription(y)));g.length>0&&(m=m.concat(["Global Options:",a(g),""]))}let d=t.visibleCommands(e).map(g=>l(t.subcommandTerm(g),t.subcommandDescription(g)));return d.length>0&&(m=m.concat(["Commands:",a(d),""])),m.join(`
|
|
7
|
+
`)}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,n,i=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 l=t-n;if(l<i)return e;let a=e.slice(0,n),m=e.slice(n).replace(`\r
|
|
5
8
|
`,`
|
|
6
|
-
`),
|
|
7
|
-
|.{1,${l-1}}([${
|
|
8
|
-
`?"":(
|
|
9
|
-
`)}};
|
|
9
|
+
`),u=" ".repeat(n),c="\\s\u200B",d=new RegExp(`
|
|
10
|
+
|.{1,${l-1}}([${c}]|$)|[^${c}]+?([${c}]|$)`,"g"),g=m.match(d)||[];return a+g.map((y,L)=>y===`
|
|
11
|
+
`?"":(L>0?u:"")+y.trimEnd()).join(`
|
|
12
|
+
`)}};Jt.Help=Fe});var ze=v(We=>{var{InvalidArgumentError:ni}=ie(),Ue=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 n=si(e);this.short=n.shortFlag,this.long=n.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}_concatValue(e,t){return t===this.defaultValue||!Array.isArray(t)?[e]:t.concat(e)}choices(e){return this.argChoices=e.slice(),this.parseArg=(t,n)=>{if(!this.argChoices.includes(t))throw new ni(`Allowed choices are ${this.argChoices.join(", ")}.`);return this.variadic?this._concatValue(t,n):t},this}name(){return this.long?this.long.replace(/^--/,""):this.short.replace(/^-/,"")}attributeName(){return ii(this.name().replace(/^no-/,""))}is(e){return this.short===e||this.long===e}isBoolean(){return!this.required&&!this.optional&&!this.negate}},Be=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,n)=>{this.positiveOptions.has(n)&&this.dualOptions.add(n)})}valueFromOption(e,t){let n=t.attributeName();if(!this.dualOptions.has(n))return!0;let i=this.negativeOptions.get(n).presetArg,s=i!==void 0?i:!1;return t.negate===(s===e)}};function ii(r){return r.split("-").reduce((e,t)=>e+t[0].toUpperCase()+t.slice(1))}function si(r){let e,t,n=r.split(/[ |,]+/);return n.length>1&&!/^[[<]/.test(n[1])&&(e=n.shift()),t=n.shift(),!e&&/^-[^-]$/.test(t)&&(e=t,t=void 0),{shortFlag:e,longFlag:t}}We.Option=Ue;We.DualOptions=Be});var Qt=v(Kt=>{function oi(r,e){if(Math.abs(r.length-e.length)>3)return Math.max(r.length,e.length);let t=[];for(let n=0;n<=r.length;n++)t[n]=[n];for(let n=0;n<=e.length;n++)t[0][n]=n;for(let n=1;n<=e.length;n++)for(let i=1;i<=r.length;i++){let s=1;r[i-1]===e[n-1]?s=0:s=1,t[i][n]=Math.min(t[i-1][n]+1,t[i][n-1]+1,t[i-1][n-1]+s),i>1&&n>1&&r[i-1]===e[n-2]&&r[i-2]===e[n-1]&&(t[i][n]=Math.min(t[i][n],t[i-2][n-2]+1))}return t[r.length][e.length]}function ai(r,e){if(!e||e.length===0)return"";e=Array.from(new Set(e));let t=r.startsWith("--");t&&(r=r.slice(2),e=e.map(o=>o.slice(2)));let n=[],i=3,s=.4;return e.forEach(o=>{if(o.length<=1)return;let l=oi(r,o),a=Math.max(r.length,o.length);(a-l)/a>s&&(l<i?(i=l,n=[o]):l===i&&n.push(o))}),n.sort((o,l)=>o.localeCompare(l)),t&&(n=n.map(o=>`--${o}`)),n.length>1?`
|
|
10
13
|
(Did you mean one of ${n.join(", ")}?)`:n.length===1?`
|
|
11
|
-
(Did you mean ${n[0]}?)`:""}
|
|
12
|
-
- specify the name in Command constructor or using .name()`);return t=t||{},t.isDefault&&(this._defaultCommandName=e._name),(t.noHelp||t.hidden)&&(e._hidden=!0),this._registerCommand(e),e.parent=this,e._checkForBrokenPassThrough(),this}createArgument(e,t){return new
|
|
13
|
-
Expecting one of '${n.join("', '")}'`);return this._lifeCycleHooks[e]?this._lifeCycleHooks[e].push(t):this._lifeCycleHooks[e]=[t],this}exitOverride(e){return e?this._exitCallback=e:this._exitCallback=t=>{if(t.code!=="commander.executeSubCommandAsync")throw t},this}_exit(e,t,n){this._exitCallback&&this._exitCallback(new
|
|
14
|
-
- already used by option '${t.flags}'`)}this.options.push(e)}_registerCommand(e){let t=
|
|
14
|
+
(Did you mean ${n[0]}?)`:""}Kt.suggestSimilar=ai});var tr=v(er=>{var mi=require("events").EventEmitter,Je=require("child_process"),P=require("path"),Ke=require("fs"),C=require("process"),{Argument:li,humanReadableArgName:ui}=fe(),{CommanderError:Qe}=ie(),{Help:ci}=Ge(),{Option:Xt,DualOptions:hi}=ze(),{suggestSimilar:Yt}=Qt(),Xe=class r extends mi{constructor(e){super(),this.commands=[],this.options=[],this.parent=null,this._allowUnknownOption=!1,this._allowExcessArguments=!0,this.registeredArguments=[],this._args=this.registeredArguments,this.args=[],this.rawArgs=[],this.processedArgs=[],this._scriptPath=null,this._name=e||"",this._optionValues={},this._optionValueSources={},this._storeOptionsAsProperties=!1,this._actionHandler=null,this._executableHandler=!1,this._executableFile=null,this._executableDir=null,this._defaultCommandName=null,this._exitCallback=null,this._aliases=[],this._combineFlagAndOptionalValue=!0,this._description="",this._summary="",this._argsDescription=void 0,this._enablePositionalOptions=!1,this._passThroughOptions=!1,this._lifeCycleHooks={},this._showHelpAfterError=!1,this._showSuggestionAfterError=!0,this._outputConfiguration={writeOut:t=>C.stdout.write(t),writeErr:t=>C.stderr.write(t),getOutHelpWidth:()=>C.stdout.isTTY?C.stdout.columns:void 0,getErrHelpWidth:()=>C.stderr.isTTY?C.stderr.columns:void 0,outputError:(t,n)=>n(t)},this._hidden=!1,this._helpOption=void 0,this._addImplicitHelpCommand=void 0,this._helpCommand=void 0,this._helpConfiguration={}}copyInheritedSettings(e){return this._outputConfiguration=e._outputConfiguration,this._helpOption=e._helpOption,this._helpCommand=e._helpCommand,this._helpConfiguration=e._helpConfiguration,this._exitCallback=e._exitCallback,this._storeOptionsAsProperties=e._storeOptionsAsProperties,this._combineFlagAndOptionalValue=e._combineFlagAndOptionalValue,this._allowExcessArguments=e._allowExcessArguments,this._enablePositionalOptions=e._enablePositionalOptions,this._showHelpAfterError=e._showHelpAfterError,this._showSuggestionAfterError=e._showSuggestionAfterError,this}_getCommandAndAncestors(){let e=[];for(let t=this;t;t=t.parent)e.push(t);return e}command(e,t,n){let i=t,s=n;typeof i=="object"&&i!==null&&(s=i,i=null),s=s||{};let[,o,l]=e.match(/([^ ]+) *(.*)/),a=this.createCommand(o);return i&&(a.description(i),a._executableHandler=!0),s.isDefault&&(this._defaultCommandName=a._name),a._hidden=!!(s.noHelp||s.hidden),a._executableFile=s.executableFile||null,l&&a.arguments(l),this._registerCommand(a),a.parent=this,a.copyInheritedSettings(this),i?this:a}createCommand(e){return new r(e)}createHelp(){return Object.assign(new ci,this.configureHelp())}configureHelp(e){return e===void 0?this._helpConfiguration:(this._helpConfiguration=e,this)}configureOutput(e){return e===void 0?this._outputConfiguration:(Object.assign(this._outputConfiguration,e),this)}showHelpAfterError(e=!0){return typeof e!="string"&&(e=!!e),this._showHelpAfterError=e,this}showSuggestionAfterError(e=!0){return this._showSuggestionAfterError=!!e,this}addCommand(e,t){if(!e._name)throw new Error(`Command passed to .addCommand() must have a name
|
|
15
|
+
- specify the name in Command constructor or using .name()`);return t=t||{},t.isDefault&&(this._defaultCommandName=e._name),(t.noHelp||t.hidden)&&(e._hidden=!0),this._registerCommand(e),e.parent=this,e._checkForBrokenPassThrough(),this}createArgument(e,t){return new li(e,t)}argument(e,t,n,i){let s=this.createArgument(e,t);return typeof n=="function"?s.default(i).argParser(n):s.default(n),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._addImplicitHelpCommand=e,this;e=e??"help [command]";let[,n,i]=e.match(/([^ ]+) *(.*)/),s=t??"display help for command",o=this.createCommand(n);return o.helpOption(!1),i&&o.arguments(i),s&&o.description(s),this._addImplicitHelpCommand=!0,this._helpCommand=o,this}addHelpCommand(e,t){return typeof e!="object"?(this.helpCommand(e,t),this):(this._addImplicitHelpCommand=!0,this._helpCommand=e,this)}_getHelpCommand(){return this._addImplicitHelpCommand??(this.commands.length&&!this._actionHandler&&!this._findCommand("help"))?(this._helpCommand===void 0&&this.helpCommand(void 0,void 0),this._helpCommand):null}hook(e,t){let n=["preSubcommand","preAction","postAction"];if(!n.includes(e))throw new Error(`Unexpected value for event passed to hook : '${e}'.
|
|
16
|
+
Expecting one of '${n.join("', '")}'`);return this._lifeCycleHooks[e]?this._lifeCycleHooks[e].push(t):this._lifeCycleHooks[e]=[t],this}exitOverride(e){return e?this._exitCallback=e:this._exitCallback=t=>{if(t.code!=="commander.executeSubCommandAsync")throw t},this}_exit(e,t,n){this._exitCallback&&this._exitCallback(new Qe(e,t,n)),C.exit(e)}action(e){let t=n=>{let i=this.registeredArguments.length,s=n.slice(0,i);return this._storeOptionsAsProperties?s[i]=this:s[i]=this.opts(),s.push(this),e.apply(this,s)};return this._actionHandler=t,this}createOption(e,t){return new Xt(e,t)}_callParseArg(e,t,n,i){try{return e.parseArg(t,n)}catch(s){if(s.code==="commander.invalidArgument"){let o=`${i} ${s.message}`;this.error(o,{exitCode:s.exitCode,code:s.code})}throw s}}_registerOption(e){let t=e.short&&this._findOption(e.short)||e.long&&this._findOption(e.long);if(t){let n=e.long&&this._findOption(e.long)?e.long:e.short;throw new Error(`Cannot add option '${e.flags}'${this._name&&` to command '${this._name}'`} due to conflicting flag '${n}'
|
|
17
|
+
- already used by option '${t.flags}'`)}this.options.push(e)}_registerCommand(e){let t=i=>[i.name()].concat(i.aliases()),n=t(e).find(i=>this._findCommand(i));if(n){let i=t(this._findCommand(n)).join("|"),s=t(e).join("|");throw new Error(`cannot add command '${s}' as already have command '${i}'`)}this.commands.push(e)}addOption(e){this._registerOption(e);let t=e.name(),n=e.attributeName();if(e.negate){let s=e.long.replace(/^--no-/,"--");this._findOption(s)||this.setOptionValueWithSource(n,e.defaultValue===void 0?!0:e.defaultValue,"default")}else e.defaultValue!==void 0&&this.setOptionValueWithSource(n,e.defaultValue,"default");let i=(s,o,l)=>{s==null&&e.presetArg!==void 0&&(s=e.presetArg);let a=this.getOptionValue(n);s!==null&&e.parseArg?s=this._callParseArg(e,s,a,o):s!==null&&e.variadic&&(s=e._concatValue(s,a)),s==null&&(e.negate?s=!1:e.isBoolean()||e.optional?s=!0:s=""),this.setOptionValueWithSource(n,s,l)};return this.on("option:"+t,s=>{let o=`error: option '${e.flags}' argument '${s}' is invalid.`;i(s,o,"cli")}),e.envVar&&this.on("optionEnv:"+t,s=>{let o=`error: option '${e.flags}' value '${s}' from env '${e.envVar}' is invalid.`;i(s,o,"env")}),this}_optionEx(e,t,n,i,s){if(typeof t=="object"&&t instanceof Xt)throw new Error("To add an Option object use addOption() instead of option() or requiredOption()");let o=this.createOption(t,n);if(o.makeOptionMandatory(!!e.mandatory),typeof i=="function")o.default(s).argParser(i);else if(i instanceof RegExp){let l=i;i=(a,m)=>{let u=l.exec(a);return u?u[0]:m},o.default(s).argParser(i)}else o.default(i);return this.addOption(o)}option(e,t,n,i){return this._optionEx({},e,t,n,i)}requiredOption(e,t,n,i){return this._optionEx({mandatory:!0},e,t,n,i)}combineFlagAndOptionalValue(e=!0){return this._combineFlagAndOptionalValue=!!e,this}allowUnknownOption(e=!0){return this._allowUnknownOption=!!e,this}allowExcessArguments(e=!0){return this._allowExcessArguments=!!e,this}enablePositionalOptions(e=!0){return this._enablePositionalOptions=!!e,this}passThroughOptions(e=!0){return this._passThroughOptions=!!e,this._checkForBrokenPassThrough(),this}_checkForBrokenPassThrough(){if(this.parent&&this._passThroughOptions&&!this.parent._enablePositionalOptions)throw new Error(`passThroughOptions cannot be used for '${this._name}' 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._optionValues).length)throw new Error("call .storeOptionsAsProperties() before setting option values");return this._storeOptionsAsProperties=!!e,this}getOptionValue(e){return this._storeOptionsAsProperties?this[e]:this._optionValues[e]}setOptionValue(e,t){return this.setOptionValueWithSource(e,t,void 0)}setOptionValueWithSource(e,t,n){return this._storeOptionsAsProperties?this[e]=t:this._optionValues[e]=t,this._optionValueSources[e]=n,this}getOptionValueSource(e){return this._optionValueSources[e]}getOptionValueSourceWithGlobals(e){let t;return this._getCommandAndAncestors().forEach(n=>{n.getOptionValueSource(e)!==void 0&&(t=n.getOptionValueSource(e))}),t}_prepareUserArgs(e,t){if(e!==void 0&&!Array.isArray(e))throw new Error("first parameter to parse must be array or undefined");t=t||{},e===void 0&&(e=C.argv,C.versions&&C.versions.electron&&(t.from="electron")),this.rawArgs=e.slice();let n;switch(t.from){case void 0:case"node":this._scriptPath=e[1],n=e.slice(2);break;case"electron":C.defaultApp?(this._scriptPath=e[1],n=e.slice(2)):n=e.slice(1);break;case"user":n=e.slice(0);break;default:throw new Error(`unexpected parse option { from: '${t.from}' }`)}return!this._name&&this._scriptPath&&this.nameFromFilename(this._scriptPath),this._name=this._name||"program",n}parse(e,t){let n=this._prepareUserArgs(e,t);return this._parseCommand([],n),this}async parseAsync(e,t){let n=this._prepareUserArgs(e,t);return await this._parseCommand([],n),this}_executeSubCommand(e,t){t=t.slice();let n=!1,i=[".js",".ts",".tsx",".mjs",".cjs"];function s(u,h){let c=P.resolve(u,h);if(Ke.existsSync(c))return c;if(i.includes(P.extname(h)))return;let d=i.find(g=>Ke.existsSync(`${c}${g}`));if(d)return`${c}${d}`}this._checkForMissingMandatoryOptions(),this._checkForConflictingOptions();let o=e._executableFile||`${this._name}-${e._name}`,l=this._executableDir||"";if(this._scriptPath){let u;try{u=Ke.realpathSync(this._scriptPath)}catch{u=this._scriptPath}l=P.resolve(P.dirname(u),l)}if(l){let u=s(l,o);if(!u&&!e._executableFile&&this._scriptPath){let h=P.basename(this._scriptPath,P.extname(this._scriptPath));h!==this._name&&(u=s(l,`${h}-${e._name}`))}o=u||o}n=i.includes(P.extname(o));let a;C.platform!=="win32"?n?(t.unshift(o),t=Zt(C.execArgv).concat(t),a=Je.spawn(C.argv[0],t,{stdio:"inherit"})):a=Je.spawn(o,t,{stdio:"inherit"}):(t.unshift(o),t=Zt(C.execArgv).concat(t),a=Je.spawn(C.execPath,t,{stdio:"inherit"})),a.killed||["SIGUSR1","SIGUSR2","SIGTERM","SIGINT","SIGHUP"].forEach(h=>{C.on(h,()=>{a.killed===!1&&a.exitCode===null&&a.kill(h)})});let m=this._exitCallback;a.on("close",(u,h)=>{u=u??1,m?m(new Qe(u,"commander.executeSubCommandAsync","(close)")):C.exit(u)}),a.on("error",u=>{if(u.code==="ENOENT"){let h=l?`searched for local subcommand relative to directory '${l}'`:"no directory for search for local subcommand, use .executableDir() to supply a custom directory",c=`'${o}' does not exist
|
|
15
18
|
- if '${e._name}' is not meant to be an executable command, remove description parameter from '.command()' and use '.description()' instead
|
|
16
19
|
- if the default executable name is not suitable, use the executableFile option to supply a custom name or path
|
|
17
|
-
- ${h}`;throw new Error(
|
|
20
|
+
- ${h}`;throw new Error(c)}else if(u.code==="EACCES")throw new Error(`'${o}' not executable`);if(!m)C.exit(1);else{let h=new Qe(1,"commander.executeSubCommandAsync","(error)");h.nestedError=u,m(h)}}),this.runningCommand=a}_dispatchSubcommand(e,t,n){let i=this._findCommand(e);i||this.help({error:!0});let s;return s=this._chainOrCallSubCommandHook(s,i,"preSubcommand"),s=this._chainOrCall(s,()=>{if(i._executableHandler)this._executeSubCommand(i,t.concat(n));else return i._parseCommand(t,n)}),s}_dispatchHelpCommand(e){e||this.help();let t=this._findCommand(e);return t&&!t._executableHandler&&t.help(),this._dispatchSubcommand(e,[],[this._getHelpOption()?.long??this._getHelpOption()?.short??"--help"])}_checkNumberOfArguments(){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._excessArguments(this.args)}_processArguments(){let e=(n,i,s)=>{let o=i;if(i!==null&&n.parseArg){let l=`error: command-argument value '${i}' is invalid for argument '${n.name()}'.`;o=this._callParseArg(n,i,s,l)}return o};this._checkNumberOfArguments();let t=[];this.registeredArguments.forEach((n,i)=>{let s=n.defaultValue;n.variadic?i<this.args.length?(s=this.args.slice(i),n.parseArg&&(s=s.reduce((o,l)=>e(n,l,o),n.defaultValue))):s===void 0&&(s=[]):i<this.args.length&&(s=this.args[i],n.parseArg&&(s=e(n,s,n.defaultValue))),t[i]=s}),this.processedArgs=t}_chainOrCall(e,t){return e&&e.then&&typeof e.then=="function"?e.then(()=>t()):t()}_chainOrCallHooks(e,t){let n=e,i=[];return this._getCommandAndAncestors().reverse().filter(s=>s._lifeCycleHooks[t]!==void 0).forEach(s=>{s._lifeCycleHooks[t].forEach(o=>{i.push({hookedCommand:s,callback:o})})}),t==="postAction"&&i.reverse(),i.forEach(s=>{n=this._chainOrCall(n,()=>s.callback(s.hookedCommand,this))}),n}_chainOrCallSubCommandHook(e,t,n){let i=e;return this._lifeCycleHooks[n]!==void 0&&this._lifeCycleHooks[n].forEach(s=>{i=this._chainOrCall(i,()=>s(this,t))}),i}_parseCommand(e,t){let n=this.parseOptions(t);if(this._parseOptionsEnv(),this._parseOptionsImplied(),e=e.concat(n.operands),t=n.unknown,this.args=e.concat(t),e&&this._findCommand(e[0]))return this._dispatchSubcommand(e[0],e.slice(1),t);if(this._getHelpCommand()&&e[0]===this._getHelpCommand().name())return this._dispatchHelpCommand(e[1]);if(this._defaultCommandName)return this._outputHelpIfRequested(t),this._dispatchSubcommand(this._defaultCommandName,e,t);this.commands.length&&this.args.length===0&&!this._actionHandler&&!this._defaultCommandName&&this.help({error:!0}),this._outputHelpIfRequested(n.unknown),this._checkForMissingMandatoryOptions(),this._checkForConflictingOptions();let i=()=>{n.unknown.length>0&&this.unknownOption(n.unknown[0])},s=`command:${this.name()}`;if(this._actionHandler){i(),this._processArguments();let o;return o=this._chainOrCallHooks(o,"preAction"),o=this._chainOrCall(o,()=>this._actionHandler(this.processedArgs)),this.parent&&(o=this._chainOrCall(o,()=>{this.parent.emit(s,e,t)})),o=this._chainOrCallHooks(o,"postAction"),o}if(this.parent&&this.parent.listenerCount(s))i(),this._processArguments(),this.parent.emit(s,e,t);else if(e.length){if(this._findCommand("*"))return this._dispatchSubcommand("*",e,t);this.listenerCount("command:*")?this.emit("command:*",e,t):this.commands.length?this.unknownCommand():(i(),this._processArguments())}else this.commands.length?(i(),this.help({error:!0})):(i(),this._processArguments())}_findCommand(e){if(e)return this.commands.find(t=>t._name===e||t._aliases.includes(e))}_findOption(e){return this.options.find(t=>t.is(e))}_checkForMissingMandatoryOptions(){this._getCommandAndAncestors().forEach(e=>{e.options.forEach(t=>{t.mandatory&&e.getOptionValue(t.attributeName())===void 0&&e.missingMandatoryOptionValue(t)})})}_checkForConflictingLocalOptions(){let e=this.options.filter(n=>{let i=n.attributeName();return this.getOptionValue(i)===void 0?!1:this.getOptionValueSource(i)!=="default"});e.filter(n=>n.conflictsWith.length>0).forEach(n=>{let i=e.find(s=>n.conflictsWith.includes(s.attributeName()));i&&this._conflictingOption(n,i)})}_checkForConflictingOptions(){this._getCommandAndAncestors().forEach(e=>{e._checkForConflictingLocalOptions()})}parseOptions(e){let t=[],n=[],i=t,s=e.slice();function o(a){return a.length>1&&a[0]==="-"}let l=null;for(;s.length;){let a=s.shift();if(a==="--"){i===n&&i.push(a),i.push(...s);break}if(l&&!o(a)){this.emit(`option:${l.name()}`,a);continue}if(l=null,o(a)){let m=this._findOption(a);if(m){if(m.required){let u=s.shift();u===void 0&&this.optionMissingArgument(m),this.emit(`option:${m.name()}`,u)}else if(m.optional){let u=null;s.length>0&&!o(s[0])&&(u=s.shift()),this.emit(`option:${m.name()}`,u)}else this.emit(`option:${m.name()}`);l=m.variadic?m:null;continue}}if(a.length>2&&a[0]==="-"&&a[1]!=="-"){let m=this._findOption(`-${a[1]}`);if(m){m.required||m.optional&&this._combineFlagAndOptionalValue?this.emit(`option:${m.name()}`,a.slice(2)):(this.emit(`option:${m.name()}`),s.unshift(`-${a.slice(2)}`));continue}}if(/^--[^=]+=/.test(a)){let m=a.indexOf("="),u=this._findOption(a.slice(0,m));if(u&&(u.required||u.optional)){this.emit(`option:${u.name()}`,a.slice(m+1));continue}}if(o(a)&&(i=n),(this._enablePositionalOptions||this._passThroughOptions)&&t.length===0&&n.length===0){if(this._findCommand(a)){t.push(a),s.length>0&&n.push(...s);break}else if(this._getHelpCommand()&&a===this._getHelpCommand().name()){t.push(a),s.length>0&&t.push(...s);break}else if(this._defaultCommandName){n.push(a),s.length>0&&n.push(...s);break}}if(this._passThroughOptions){i.push(a),s.length>0&&i.push(...s);break}i.push(a)}return{operands:t,unknown:n}}opts(){if(this._storeOptionsAsProperties){let e={},t=this.options.length;for(let n=0;n<t;n++){let i=this.options[n].attributeName();e[i]=i===this._versionOptionName?this._version:this[i]}return e}return this._optionValues}optsWithGlobals(){return this._getCommandAndAncestors().reduce((e,t)=>Object.assign(e,t.opts()),{})}error(e,t){this._outputConfiguration.outputError(`${e}
|
|
18
21
|
`,this._outputConfiguration.writeErr),typeof this._showHelpAfterError=="string"?this._outputConfiguration.writeErr(`${this._showHelpAfterError}
|
|
19
22
|
`):this._showHelpAfterError&&(this._outputConfiguration.writeErr(`
|
|
20
|
-
`),this.outputHelp({error:!0}));let n=t||{},
|
|
21
|
-
`),this._exit(0,"commander.version",e)}),this}description(e,t){return e===void 0&&t===void 0?this._description:(this._description=e,t&&(this._argsDescription=t),this)}summary(e){return e===void 0?this._summary:(this._summary=e,this)}alias(e){if(e===void 0)return this._aliases[0];let t=this;if(this.commands.length!==0&&this.commands[this.commands.length-1]._executableHandler&&(t=this.commands[this.commands.length-1]),e===t._name)throw new Error("Command alias can't be the same as its name");let n=this.parent?._findCommand(e);if(n){let
|
|
22
|
-
Expecting one of '${n.join("', '")}'`);let
|
|
23
|
-
`)}),this}_outputHelpIfRequested(e){let t=this._getHelpOption();t&&e.find(
|
|
23
|
+
`),this.outputHelp({error:!0}));let n=t||{},i=n.exitCode||1,s=n.code||"commander.error";this._exit(i,s,e)}_parseOptionsEnv(){this.options.forEach(e=>{if(e.envVar&&e.envVar in C.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()}`,C.env[e.envVar]):this.emit(`optionEnv:${e.name()}`))}})}_parseOptionsImplied(){let e=new hi(this.options),t=n=>this.getOptionValue(n)!==void 0&&!["default","implied"].includes(this.getOptionValueSource(n));this.options.filter(n=>n.implied!==void 0&&t(n.attributeName())&&e.valueFromOption(this.getOptionValue(n.attributeName()),n)).forEach(n=>{Object.keys(n.implied).filter(i=>!t(i)).forEach(i=>{this.setOptionValueWithSource(i,n.implied[i],"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"})}_conflictingOption(e,t){let n=o=>{let l=o.attributeName(),a=this.getOptionValue(l),m=this.options.find(h=>h.negate&&l===h.attributeName()),u=this.options.find(h=>!h.negate&&l===h.attributeName());return m&&(m.presetArg===void 0&&a===!1||m.presetArg!==void 0&&a===m.presetArg)?m:u||o},i=o=>{let l=n(o),a=l.attributeName();return this.getOptionValueSource(a)==="env"?`environment variable '${l.envVar}'`:`option '${l.flags}'`},s=`error: ${i(e)} cannot be used with ${i(t)}`;this.error(s,{code:"commander.conflictingOption"})}unknownOption(e){if(this._allowUnknownOption)return;let t="";if(e.startsWith("--")&&this._showSuggestionAfterError){let i=[],s=this;do{let o=s.createHelp().visibleOptions(s).filter(l=>l.long).map(l=>l.long);i=i.concat(o),s=s.parent}while(s&&!s._enablePositionalOptions);t=Yt(e,i)}let n=`error: unknown option '${e}'${t}`;this.error(n,{code:"commander.unknownOption"})}_excessArguments(e){if(this._allowExcessArguments)return;let t=this.registeredArguments.length,n=t===1?"":"s",s=`error: too many arguments${this.parent?` for '${this.name()}'`:""}. Expected ${t} argument${n} but got ${e.length}.`;this.error(s,{code:"commander.excessArguments"})}unknownCommand(){let e=this.args[0],t="";if(this._showSuggestionAfterError){let i=[];this.createHelp().visibleCommands(this).forEach(s=>{i.push(s.name()),s.alias()&&i.push(s.alias())}),t=Yt(e,i)}let n=`error: unknown command '${e}'${t}`;this.error(n,{code:"commander.unknownCommand"})}version(e,t,n){if(e===void 0)return this._version;this._version=e,t=t||"-V, --version",n=n||"output the version number";let i=this.createOption(t,n);return this._versionOptionName=i.attributeName(),this._registerOption(i),this.on("option:"+i.name(),()=>{this._outputConfiguration.writeOut(`${e}
|
|
24
|
+
`),this._exit(0,"commander.version",e)}),this}description(e,t){return e===void 0&&t===void 0?this._description:(this._description=e,t&&(this._argsDescription=t),this)}summary(e){return e===void 0?this._summary:(this._summary=e,this)}alias(e){if(e===void 0)return this._aliases[0];let t=this;if(this.commands.length!==0&&this.commands[this.commands.length-1]._executableHandler&&(t=this.commands[this.commands.length-1]),e===t._name)throw new Error("Command alias can't be the same as its name");let n=this.parent?._findCommand(e);if(n){let i=[n.name()].concat(n.aliases()).join("|");throw new Error(`cannot add alias '${e}' to command '${this.name()}' as already have command '${i}'`)}return t._aliases.push(e),this}aliases(e){return e===void 0?this._aliases:(e.forEach(t=>this.alias(t)),this)}usage(e){if(e===void 0){if(this._usage)return this._usage;let t=this.registeredArguments.map(n=>ui(n));return[].concat(this.options.length||this._helpOption!==null?"[options]":[],this.commands.length?"[command]":[],this.registeredArguments.length?t:[]).join(" ")}return this._usage=e,this}name(e){return e===void 0?this._name:(this._name=e,this)}nameFromFilename(e){return this._name=P.basename(e,P.extname(e)),this}executableDir(e){return e===void 0?this._executableDir:(this._executableDir=e,this)}helpInformation(e){let t=this.createHelp();return t.helpWidth===void 0&&(t.helpWidth=e&&e.error?this._outputConfiguration.getErrHelpWidth():this._outputConfiguration.getOutHelpWidth()),t.formatHelp(this,t)}_getHelpContext(e){e=e||{};let t={error:!!e.error},n;return t.error?n=i=>this._outputConfiguration.writeErr(i):n=i=>this._outputConfiguration.writeOut(i),t.write=e.write||n,t.command=this,t}outputHelp(e){let t;typeof e=="function"&&(t=e,e=void 0);let n=this._getHelpContext(e);this._getCommandAndAncestors().reverse().forEach(s=>s.emit("beforeAllHelp",n)),this.emit("beforeHelp",n);let i=this.helpInformation(n);if(t&&(i=t(i),typeof i!="string"&&!Buffer.isBuffer(i)))throw new Error("outputHelp callback must return a string or a Buffer");n.write(i),this._getHelpOption()?.long&&this.emit(this._getHelpOption().long),this.emit("afterHelp",n),this._getCommandAndAncestors().forEach(s=>s.emit("afterAllHelp",n))}helpOption(e,t){return typeof e=="boolean"?(e?this._helpOption=this._helpOption??void 0:this._helpOption=null,this):(e=e??"-h, --help",t=t??"display help for command",this._helpOption=this.createOption(e,t),this)}_getHelpOption(){return this._helpOption===void 0&&this.helpOption(void 0,void 0),this._helpOption}addHelpOption(e){return this._helpOption=e,this}help(e){this.outputHelp(e);let t=C.exitCode||0;t===0&&e&&typeof e!="function"&&e.error&&(t=1),this._exit(t,"commander.help","(outputHelp)")}addHelpText(e,t){let n=["beforeAll","before","after","afterAll"];if(!n.includes(e))throw new Error(`Unexpected value for position to addHelpText.
|
|
25
|
+
Expecting one of '${n.join("', '")}'`);let i=`${e}Help`;return this.on(i,s=>{let o;typeof t=="function"?o=t({error:s.error,command:s.command}):o=t,o&&s.write(`${o}
|
|
26
|
+
`)}),this}_outputHelpIfRequested(e){let t=this._getHelpOption();t&&e.find(i=>t.is(i))&&(this.outputHelp(),this._exit(0,"commander.helpDisplayed","(outputHelp)"))}};function Zt(r){return r.map(e=>{if(!e.startsWith("--inspect"))return e;let t,n="127.0.0.1",i="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])?i=s[3]:n=s[3]):(s=e.match(/^(--inspect(-brk|-port)?)=([^:]+):(\d+)$/))!==null&&(t=s[1],n=s[3],i=s[4]),t&&i!=="0"?`${t}=${n}:${parseInt(i)+1}`:e})}er.Command=Xe});var sr=v(k=>{var{Argument:rr}=fe(),{Command:Ye}=tr(),{CommanderError:fi,InvalidArgumentError:nr}=ie(),{Help:pi}=Ge(),{Option:ir}=ze();k.program=new Ye;k.createCommand=r=>new Ye(r);k.createOption=(r,e)=>new ir(r,e);k.createArgument=(r,e)=>new rr(r,e);k.Command=Ye;k.Option=ir;k.Argument=rr;k.Help=pi;k.CommanderError=fi;k.InvalidArgumentError=nr;k.InvalidOptionArgumentError=nr});var hr=v((Ns,cr)=>{cr.exports=ur;ur.sync=gi;var mr=require("fs");function di(r,e){var t=e.pathExt!==void 0?e.pathExt:process.env.PATHEXT;if(!t||(t=t.split(";"),t.indexOf("")!==-1))return!0;for(var n=0;n<t.length;n++){var i=t[n].toLowerCase();if(i&&r.substr(-i.length).toLowerCase()===i)return!0}return!1}function lr(r,e,t){return!r.isSymbolicLink()&&!r.isFile()?!1:di(e,t)}function ur(r,e,t){mr.stat(r,function(n,i){t(n,n?!1:lr(i,r,e))})}function gi(r,e){return lr(mr.statSync(r),r,e)}});var _r=v(($s,gr)=>{gr.exports=pr;pr.sync=_i;var fr=require("fs");function pr(r,e,t){fr.stat(r,function(n,i){t(n,n?!1:dr(i,e))})}function _i(r,e){return dr(fr.statSync(r),e)}function dr(r,e){return r.isFile()&&vi(r,e)}function vi(r,e){var t=r.mode,n=r.uid,i=r.gid,s=e.uid!==void 0?e.uid:process.getuid&&process.getuid(),o=e.gid!==void 0?e.gid:process.getgid&&process.getgid(),l=parseInt("100",8),a=parseInt("010",8),m=parseInt("001",8),u=l|a,h=t&m||t&a&&i===o||t&l&&n===s||t&u&&s===0;return h}});var yr=v((Is,vr)=>{var Ps=require("fs"),pe;process.platform==="win32"||global.TESTING_WINDOWS?pe=hr():pe=_r();vr.exports=Ze;Ze.sync=yi;function Ze(r,e,t){if(typeof e=="function"&&(t=e,e={}),!t){if(typeof Promise!="function")throw new TypeError("callback not provided");return new Promise(function(n,i){Ze(r,e||{},function(s,o){s?i(s):n(o)})})}pe(r,e||{},function(n,i){n&&(n.code==="EACCES"||e&&e.ignoreErrors)&&(n=null,i=!1),t(n,i)})}function yi(r,e){try{return pe.sync(r,e||{})}catch(t){if(e&&e.ignoreErrors||t.code==="EACCES")return!1;throw t}}});var Or=v((Rs,Er)=>{var Q=process.platform==="win32"||process.env.OSTYPE==="cygwin"||process.env.OSTYPE==="msys",wr=require("path"),wi=Q?";":":",Cr=yr(),Sr=r=>Object.assign(new Error(`not found: ${r}`),{code:"ENOENT"}),br=(r,e)=>{let t=e.colon||wi,n=r.match(/\//)||Q&&r.match(/\\/)?[""]:[...Q?[process.cwd()]:[],...(e.path||process.env.PATH||"").split(t)],i=Q?e.pathExt||process.env.PATHEXT||".EXE;.CMD;.BAT;.COM":"",s=Q?i.split(t):[""];return Q&&r.indexOf(".")!==-1&&s[0]!==""&&s.unshift(""),{pathEnv:n,pathExt:s,pathExtExe:i}},Ar=(r,e,t)=>{typeof e=="function"&&(t=e,e={}),e||(e={});let{pathEnv:n,pathExt:i,pathExtExe:s}=br(r,e),o=[],l=m=>new Promise((u,h)=>{if(m===n.length)return e.all&&o.length?u(o):h(Sr(r));let c=n[m],d=/^".*"$/.test(c)?c.slice(1,-1):c,g=wr.join(d,r),y=!d&&/^\.[\\\/]/.test(r)?r.slice(0,2)+g:g;u(a(y,m,0))}),a=(m,u,h)=>new Promise((c,d)=>{if(h===i.length)return c(l(u+1));let g=i[h];Cr(m+g,{pathExt:s},(y,L)=>{if(!y&&L)if(e.all)o.push(m+g);else return c(m+g);return c(a(m,u,h+1))})});return t?l(0).then(m=>t(null,m),t):l(0)},Ci=(r,e)=>{e=e||{};let{pathEnv:t,pathExt:n,pathExtExe:i}=br(r,e),s=[];for(let o=0;o<t.length;o++){let l=t[o],a=/^".*"$/.test(l)?l.slice(1,-1):l,m=wr.join(a,r),u=!a&&/^\.[\\\/]/.test(r)?r.slice(0,2)+m:m;for(let h=0;h<n.length;h++){let c=u+n[h];try{if(Cr.sync(c,{pathExt:i}))if(e.all)s.push(c);else return c}catch{}}}if(e.all&&s.length)return s;if(e.nothrow)return null;throw Sr(r)};Er.exports=Ar;Ar.sync=Ci});var kr=v((Vs,et)=>{"use strict";var xr=(r={})=>{let e=r.env||process.env;return(r.platform||process.platform)!=="win32"?"PATH":Object.keys(e).reverse().find(n=>n.toUpperCase()==="PATH")||"Path"};et.exports=xr;et.exports.default=xr});var $r=v((Ts,Nr)=>{"use strict";var Mr=require("path"),Si=Or(),bi=kr();function Lr(r,e){let t=r.options.env||process.env,n=process.cwd(),i=r.options.cwd!=null,s=i&&process.chdir!==void 0&&!process.chdir.disabled;if(s)try{process.chdir(r.options.cwd)}catch{}let o;try{o=Si.sync(r.command,{path:t[bi({env:t})],pathExt:e?Mr.delimiter:void 0})}catch{}finally{s&&process.chdir(n)}return o&&(o=Mr.resolve(i?r.options.cwd:"",o)),o}function Ai(r){return Lr(r)||Lr(r,!0)}Nr.exports=Ai});var Pr=v((js,rt)=>{"use strict";var tt=/([()\][%!^"`<>&|;, *?])/g;function Ei(r){return r=r.replace(tt,"^$1"),r}function Oi(r,e){return r=`${r}`,r=r.replace(/(\\*)"/g,'$1$1\\"'),r=r.replace(/(\\*)$/,"$1$1"),r=`"${r}"`,r=r.replace(tt,"^$1"),e&&(r=r.replace(tt,"^$1")),r}rt.exports.command=Ei;rt.exports.argument=Oi});var Rr=v((Ds,Ir)=>{"use strict";Ir.exports=/^#!(.*)/});var Tr=v((qs,Vr)=>{"use strict";var xi=Rr();Vr.exports=(r="")=>{let e=r.match(xi);if(!e)return null;let[t,n]=e[0].replace(/#! ?/,"").split(" "),i=t.split("/").pop();return i==="env"?n:n?`${i} ${n}`:i}});var Dr=v((Hs,jr)=>{"use strict";var nt=require("fs"),ki=Tr();function Mi(r){let t=Buffer.alloc(150),n;try{n=nt.openSync(r,"r"),nt.readSync(n,t,0,150,0),nt.closeSync(n)}catch{}return ki(t.toString())}jr.exports=Mi});var Gr=v((Fs,Fr)=>{"use strict";var Li=require("path"),qr=$r(),Hr=Pr(),Ni=Dr(),$i=process.platform==="win32",Pi=/\.(?:com|exe)$/i,Ii=/node_modules[\\/].bin[\\/][^\\/]+\.cmd$/i;function Ri(r){r.file=qr(r);let e=r.file&&Ni(r.file);return e?(r.args.unshift(r.file),r.command=e,qr(r)):r.file}function Vi(r){if(!$i)return r;let e=Ri(r),t=!Pi.test(e);if(r.options.forceShell||t){let n=Ii.test(e);r.command=Li.normalize(r.command),r.command=Hr.command(r.command),r.args=r.args.map(s=>Hr.argument(s,n));let i=[r.command].concat(r.args).join(" ");r.args=["/d","/s","/c",`"${i}"`],r.command=process.env.comspec||"cmd.exe",r.options.windowsVerbatimArguments=!0}return r}function Ti(r,e,t){e&&!Array.isArray(e)&&(t=e,e=null),e=e?e.slice(0):[],t=Object.assign({},t);let n={command:r,args:e,options:t,file:void 0,original:{command:r,args:e}};return t.shell?n:Vi(n)}Fr.exports=Ti});var Wr=v((Gs,Br)=>{"use strict";var it=process.platform==="win32";function st(r,e){return Object.assign(new Error(`${e} ${r.command} ENOENT`),{code:"ENOENT",errno:"ENOENT",syscall:`${e} ${r.command}`,path:r.command,spawnargs:r.args})}function ji(r,e){if(!it)return;let t=r.emit;r.emit=function(n,i){if(n==="exit"){let s=Ur(i,e,"spawn");if(s)return t.call(r,"error",s)}return t.apply(r,arguments)}}function Ur(r,e){return it&&r===1&&!e.file?st(e.original,"spawn"):null}function Di(r,e){return it&&r===1&&!e.file?st(e.original,"spawnSync"):null}Br.exports={hookChildProcess:ji,verifyENOENT:Ur,verifyENOENTSync:Di,notFoundError:st}});var Kr=v((Us,X)=>{"use strict";var zr=require("child_process"),ot=Gr(),at=Wr();function Jr(r,e,t){let n=ot(r,e,t),i=zr.spawn(n.command,n.args,n.options);return at.hookChildProcess(i,n),i}function qi(r,e,t){let n=ot(r,e,t),i=zr.spawnSync(n.command,n.args,n.options);return i.error=i.error||at.verifyENOENTSync(i.status,n),i}X.exports=Jr;X.exports.spawn=Jr;X.exports.sync=qi;X.exports._parse=ot;X.exports._enoent=at});zt().install();var or=U(sr(),1),{program:Cs,createCommand:Ss,createArgument:bs,createOption:As,CommanderError:Es,InvalidArgumentError:Os,InvalidOptionArgumentError:xs,Command:ar,Argument:ks,Option:H,Help:Ms}=or.default;var F=U(Kr()),_=U(require("fs")),mn=U(require("os")),p=U(require("path"));var Hi=/[\p{Lu}]/u,Fi=/[\p{Ll}]/u,Qr=/^[\p{Lu}](?![\p{Lu}])/gu,Zr=/([\p{Alpha}\p{N}_]|$)/u,mt=/[_.\- ]+/,Gi=new RegExp("^"+mt.source),Xr=new RegExp(mt.source+Zr.source,"gu"),Yr=new RegExp("\\d+"+Zr.source,"gu"),Ui=(r,e,t,n)=>{let i=!1,s=!1,o=!1,l=!1;for(let a=0;a<r.length;a++){let m=r[a];l=a>2?r[a-3]==="-":!0,i&&Hi.test(m)?(r=r.slice(0,a)+"-"+r.slice(a),i=!1,o=s,s=!0,a++):s&&o&&Fi.test(m)&&(!l||n)?(r=r.slice(0,a-1)+"-"+r.slice(a-1),o=s,s=!1,i=!0):(i=e(m)===m&&t(m)!==m,o=s,s=t(m)===m&&e(m)!==m)}return r},Bi=(r,e)=>(Qr.lastIndex=0,r.replaceAll(Qr,t=>e(t))),Wi=(r,e)=>(Xr.lastIndex=0,Yr.lastIndex=0,r.replaceAll(Yr,(t,n,i)=>["_","-"].includes(r.charAt(i+t.length))?t:e(t)).replaceAll(Xr,(t,n)=>e(n)));function lt(r,e){if(!(typeof r=="string"||Array.isArray(r)))throw new TypeError("Expected the input to be `string | string[]`");if(e={pascalCase:!1,preserveConsecutiveUppercase:!1,...e},Array.isArray(r)?r=r.map(s=>s.trim()).filter(s=>s.length).join("-"):r=r.trim(),r.length===0)return"";let t=e.locale===!1?s=>s.toLowerCase():s=>s.toLocaleLowerCase(e.locale),n=e.locale===!1?s=>s.toUpperCase():s=>s.toLocaleUpperCase(e.locale);return r.length===1?mt.test(r)?"":e.pascalCase?n(r):t(r):(r!==t(r)&&(r=Ui(r,t,n,e.preserveConsecutiveUppercase)),r=r.replace(Gi,""),r=e.preserveConsecutiveUppercase?Bi(r,t):t(r),e.pascalCase&&(r=n(r.charAt(0))+r.slice(1)),Wi(r,n))}var de="1.1.5";var tn=()=>{se(),console.log(`
|
|
24
27
|
\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@
|
|
25
28
|
\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m \x1B[38;5;016m \x1B[38;5;016m \x1B[38;5;016m \x1B[38;5;016m \x1B[38;5;016m \x1B[38;5;016m \x1B[38;5;016m \x1B[38;5;016m \x1B[38;5;016m \x1B[38;5;016m \x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@
|
|
26
29
|
\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;016m \x1B[38;5;016m \x1B[38;5;016m \x1B[38;5;016m \x1B[38;5;016m \x1B[38;5;016m \x1B[38;5;016m \x1B[38;5;016m \x1B[38;5;016m \x1B[38;5;016m \x1B[38;5;016m \x1B[38;5;016m \x1B[38;5;016m \x1B[38;5;016m \x1B[38;5;016m \x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@
|
|
@@ -44,4 +47,4 @@ Expecting one of '${n.join("', '")}'`);let s=`${e}Help`;return this.on(s,r=>{let
|
|
|
44
47
|
\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;016m \x1B[38;5;016m \x1B[38;5;016m \x1B[38;5;016m \x1B[38;5;016m \x1B[38;5;016m \x1B[38;5;016m \x1B[38;5;016m \x1B[38;5;016m \x1B[38;5;016m \x1B[38;5;016m \x1B[38;5;016m \x1B[38;5;016m \x1B[38;5;016m \x1B[38;5;m \x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@
|
|
45
48
|
\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m/\x1B[38;5;016m \x1B[38;5;016m \x1B[38;5;016m \x1B[38;5;016m \x1B[38;5;016m \x1B[38;5;016m \x1B[38;5;016m \x1B[38;5;016m \x1B[38;5;016m \x1B[38;5;016m \x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@
|
|
46
49
|
\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@
|
|
47
|
-
\x1B[0m`),console.log(""),console.log("---------------------- Seeka Apps CLI ----------------------"),console.log(`-------------------------- v${
|
|
50
|
+
\x1B[0m`),console.log(""),console.log("---------------------- Seeka Apps CLI ----------------------"),console.log(`-------------------------- v${de} -------------------------`),console.log(""),console.log("https://developers.seeka.co"),console.log("for help: npx @seeka-labs/cli-apps@latest --help"),console.log("for scaffolding help: npx @seeka-labs/cli-apps@latest init --help"),se()},se=()=>{console.log(""),console.log("------------------------------------------------------------"),console.log("")};var Y=U(require("fs")),rn=require("os"),nn=r=>/^[a-zA-Z0-9-]+$/.test(r);function sn(r){try{let e=Y.opendirSync(r),t=e.readSync();return e.closeSync(),t===null}catch{return!1}}function on(r){let e={};return!r||r.length===0||r.forEach(t=>{let n=t.indexOf("=");if(n===-1){e[t]="";return}let i=t.substring(0,n),s=t.substring(n+1);e[i]=s}),e}var Ji=r=>Y.readFileSync(r,"utf-8").split(rn.EOL);var Ki=(r,e,t)=>{let n=Ji(r),i=n.find(s=>s.split("=")[0]===e);if(i!==void 0){let s=n.indexOf(i);n.splice(s,1,`${e}="${t}"`)}else n.push(`${e}="${t}"`);Y.writeFileSync(r,n.join(rn.EOL))},ut=(r,e)=>{e&&Object.keys(e).forEach(t=>{Ki(r,t,e[t])})};var ln=r=>{if(!nn(r.appName)){console.error("App name must be alphanumeric and hyphens only");return}if(!r.appName.startsWith("seeka-app-")){console.error("App name must start with seeka-app-");return}let e=r.appName,t=lt(r.appName.replace("seeka-app-",""),{pascalCase:!0}),n=p.resolve(r.outputDirectory,r.skipSubDir?"":r.directoryName||e);console.log(`Creating new ${r.template.replace(/-/g," ")} Seeka app in ${n}`),console.log("");let i=p.resolve(n,".git"),s=_.existsSync(i),o=p.resolve(mn.default.tmpdir(),".seeka-app-init-git-"+new Date().getTime());if(_.existsSync(o)||_.mkdirSync(o,{recursive:!0}),!r.skipSubDir&&_.existsSync(n)&&sn(n)===!1)if(r.force)console.log("--force was used and destination directory is not empty. Clearing out the directory"),s&&(console.info(".git directory found in directory, I will preserve it and remove all other files and directories to prepare for the app creation"),_.cpSync(i,o,{recursive:!0})),_.rmSync(n,{recursive:!0,force:!0});else{console.error("Directory is not empty. Use --force to create app in non-empty directory");return}_.existsSync(n)||_.mkdirSync(n,{recursive:!0}),s&&(_.cpSync(o,i,{recursive:!0}),_.rmSync(o,{recursive:!0}),console.info("Restored .git directory"));let l=p.resolve(__dirname,"init-templates"),a=p.resolve(l,r.template);_.cpSync(a,n,{recursive:!0}),_.renameSync(p.join(n,".example.gitignore"),p.join(n,".gitignore"));let m=require(p.join(n,"package.json"));m.name=r.appName,m.version=de,m.description=`Seeka app ${r.appName}`,m.author=`${r.developerName} <${r.developerEmail}>`,m.scripts.deploy=m.scripts.deploy.replace(/seeka-app-example-name/i,r.appName),m.scripts.tunnel=m.scripts.tunnel.replace(/seeka-app-example-name/i,r.appName);let u=p.resolve(p.join(n,"README.md")),h=_.readFileSync(u,"utf8");h=h.replace(/seeka-app-example-name/g,r.appName),_.writeFileSync(u,h);let c=p.resolve(p.join(n,".gitlab-ci.yml")),d=_.readFileSync(c,"utf8");switch(d=d.replace(/seeka-app-example-name/g,r.appName),_.writeFileSync(c,d),r.template){case"aws-lambda":es(r,n,m,t);break;case"azure-function":Yi(r,n,m,t);break;case"netlify-function":Zi(r,n,m,t);break}if(V(p.join(n,"src","lib","state","seeka","installations.ts"),{SampleApp:t+"App"}),Xi(r,n,l,t),Qi(r,m),_.writeFileSync(p.resolve(p.join(n,"package.json")),JSON.stringify(m,null,2)),console.info("Scaffolded package.json"),console.log(""),r.installDependencies)switch(console.info("Installing dependencies with "+r.packageManager),r.packageManager){case"npm":F.sync("npm",["install"],{stdio:"inherit",cwd:n}),r.browser&&F.sync("npm",["install"],{stdio:"inherit",cwd:p.join(n,"src","browser")});break;case"pnpm":F.sync("pnpm",["install"],{stdio:"inherit",cwd:n}),r.browser&&F.sync("pnpm",["install"],{stdio:"inherit",cwd:p.join(n,"src","browser")});break;case"yarn":F.sync("yarn",["install"],{stdio:"inherit",cwd:n}),r.browser&&F.sync("yarn",["install"],{stdio:"inherit",cwd:p.join(n,"src","browser")});break;default:console.error("Invalid package manager");return}se(),console.log(`Created ${e} in ${n}`),console.log("Boom! Your new Seeka app is ready!"),se();let g=r.skipSubDir?n:p.relative(process.cwd(),n);console.log(`Run "cd ${g}" to change to your apps directory and start creating some magic!`),console.log(""),console.log("")},Qi=(r,e)=>{let t;switch(r.packageManager){case"npm":t="npm run";break;case"pnpm":t="pnpm run";break;case"yarn":t="yarn";break;default:console.error("Invalid package manager");return}for(let n in e.scripts)e.scripts[n]=e.scripts[n].replace(/<packageManagerRunPrefix>/g,t);e.dependencies&&e.dependencies["@seeka-labs/sdk-apps-server"]&&(e.dependencies["@seeka-labs/sdk-apps-server"]="^"+e.version)},Xi=(r,e,t,n)=>{if(!r.browser){an(e);return}if(r.template!=="azure-function"){console.warn("Browser plugin is only supported for Azure function template, skipping browser plugin creation"),an(e);return}_.mkdirSync(p.resolve(p.join(e,"src","browser")),{recursive:!0}),_.cpSync(p.resolve(p.join(t,"browser")),p.resolve(p.join(e,"src","browser")),{recursive:!0});let i=p.resolve(p.join(e,"src","browser")),s=require(p.join(i,"package.json"));s.name=s.name.replace(/seeka-app-example-name/i,r.appName),s.description=s.description.replace(/seeka-app-example-name/i,r.appName),s.scripts.build=s.scripts.build.replace(/seeka-app-example-name/i,r.appName),s.scripts["build:dev"]=s.scripts["build:dev"].replace(/seeka-app-example-name/i,r.appName),s.scripts.watch=s.scripts.watch.replace(/seeka-app-example-name/i,r.appName),_.writeFileSync(p.join(i,"package.json"),JSON.stringify(s,null,2)),V(p.join(e,"src","lib","browser","index.ts"),{"seeka-app-example-name":r.appName}),V(p.join(i,"README.md"),{"seeka-app-example-name":r.appName}),V(p.join(i,"src","plugin","index.ts"),{"seeka-app-example-name":r.appName,SampleApp:n+"App"}),V(p.join(i,"src","browser.ts"),{SampleApp:n+"App"}),V(p.join(i,"package.json"),{SampleApp:n+"App"}),console.info("Scaffolded browser plugin"),console.log("")},V=(r,e)=>{let t=_.readFileSync(p.resolve(r),"utf8");for(let n in e)t=t.replace(new RegExp(n,"g"),e[n]);_.writeFileSync(p.resolve(r),t)},an=r=>{_.rmSync(p.resolve(p.join(r,"src","lib","browser")),{recursive:!0})},Yi=(r,e,t,n)=>{if(_.renameSync(p.join(e,"local.settings.example.json"),p.join(e,"local.settings.json")),r.environmentVariables&&Object.keys(r.environmentVariables).length>0){let i=require(p.join(e,"local.settings.json"));i.Values={...i.Values,...r.environmentVariables},_.writeFileSync(p.join(e,"local.settings.json"),JSON.stringify(i,null,2))}r.browser&&(t.scripts.build="tsc && cd src/browser && yarn && yarn build && cd ../",t.scripts.watch="cd src/browser && yarn && yarn build && cd ../ && tsc -w"),V(p.join(e,"src","lib","browser","models","index.ts"),{SampleApp:n+"App"}),V(p.join(e,"src","lib","browser","index.ts"),{SampleApp:n+"App"}),console.info("Scaffolded Azure function")},Zi=(r,e,t,n)=>{_.renameSync(p.join(e,".env.example"),p.join(e,".env")),r.environmentVariables&&Object.keys(r.environmentVariables).length>0&&ut(p.join(e,".env"),r.environmentVariables),console.info("Scaffolded Netlify function")},es=(r,e,t,n)=>{_.renameSync(p.join(e,".env.example"),p.join(e,".env")),r.environmentVariables&&Object.keys(r.environmentVariables).length>0&&ut(p.join(e,".env"),r.environmentVariables),console.info("Scaffolded AWS lambda function")};var ct=new ar;tn();ct.command("init").description("initialises a new Seeka app").argument("<name>",'name of your app. alphanumeric and hyphens only and must start with "seeka-app-"').addOption(new H("--template <template>","app template").choices(["azure-function","aws-lambda","netlify-function"]).makeOptionMandatory()).addOption(new H("--developer <developer>","app developer name or company").makeOptionMandatory()).addOption(new H("--email <email>","app developer email").makeOptionMandatory()).addOption(new H("--outName [outName]","directory name of the app. a new directory will be created with this name to contain the app.")).addOption(new H("--outDir [outDir]","output directory to create the app in. a new directory will be created here that contains the app.").default("","current working dir")).addOption(new H("--packageManager [packageManager]","package manager").choices(["yarn","npm","pnpm"]).default("yarn")).option("--noDependencies","skip installing dependencies").option("--skipSubDir","use sub directory for app files instead of root folder").option("--force","force creation of app in non-empty directory").option("--browser","adds support for browser plugin served from the app").option("--env [env...]","sets environment variables for the app. Use format of --env KEY1=VALUE1 KEY2=VALUE2").action((r,e)=>{let t={appName:r,template:e.template,skipSubDir:e.skipSubDir,browser:e.browser,outputDirectory:e.outDir||process.cwd(),directoryName:e.outName||void 0,packageManager:e.packageManager,developerEmail:e.email,developerName:e.developer,installDependencies:!e.noDependencies,force:e.force,environmentVariables:on(e.env)};ln(t)}).showHelpAfterError(!0);ct.showHelpAfterError(!0);ct.parse();
|