@serverless-devs/s3 0.1.4-beta.1 → 0.1.4

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/lib/index.js CHANGED
@@ -206,7 +206,7 @@ Calls to async() callback can have unexpected results.`),l=!0,function(d,m){d?c(
206
206
  Please select an access:`,choices:n.map(i=>({name:i,value:i}))}]);r=u}(0,cY.transform)(t,(n,u,i)=>{u.__default=Tht.CRYPTO_FALSE,(0,cY.set)(n,i,u)}),(0,cY.set)(t,`${r}.__default`,Tht.CRYPTO_TRUE),yield(0,vge.writeData)(t)})});var yl=L($y=>{"use strict";var kht=$y&&$y.__awaiter||function(e,t,r,n){function u(i){return i instanceof r?i:new r(function(o){o(i)})}return new(r||(r=Promise))(function(i,o){function s(l){try{c(n.next(l))}catch(f){o(f)}}function a(l){try{c(n.throw(l))}catch(f){o(f)}}function c(l){l.done?i(l.value):u(l.value).then(s,a)}c((n=n.apply(e,t||[])).next())})},H8=$y&&$y.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty($y,"__esModule",{value:!0});var eon=ar(),ton=H8(K9()),ron=H8(Spt()),non=H8(wht()),uon=H8(pge()),ion=H8(Sht()),oon=H8(Oht()),son=H8(sY()),aon=H8(Pht()),Dge=class{constructor({logger:t}={}){this.getAll=uon.default,this.remove=oon.default,this.rename=ion.default,this.decrypt=son.default,this.default=aon.default,ton.default.set(t)}get(t){return kht(this,void 0,void 0,function*(){return yield new non.default(t).run()})}set(t){return kht(this,void 0,void 0,function*(){return yield new ron.default().run((0,eon.cloneDeep)(t||{}))})}};$y.default=Dge});var yge=L(na=>{"use strict";var con=na&&na.__createBinding||(Object.create?function(e,t,r,n){n===void 0&&(n=r);var u=Object.getOwnPropertyDescriptor(t,r);(!u||("get"in u?!t.__esModule:u.writable||u.configurable))&&(u={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,n,u)}:function(e,t,r,n){n===void 0&&(n=r),e[n]=t[r]}),lon=na&&na.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),fon=na&&na.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(e!=null)for(var r in e)r!=="default"&&Object.prototype.hasOwnProperty.call(e,r)&&con(t,e,r);return lon(t,e),t},pon=na&&na.__awaiter||function(e,t,r,n){function u(i){return i instanceof r?i:new r(function(o){o(i)})}return new(r||(r=Promise))(function(i,o){function s(l){try{c(n.next(l))}catch(f){o(f)}}function a(l){try{c(n.throw(l))}catch(f){o(f)}}function c(l){l.done?i(l.value):u(l.value).then(s,a)}c((n=n.apply(e,t||[])).next())})},Rht=na&&na.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(na,"__esModule",{value:!0});na.getCredential=na.isExtendMode=na.getDefaultYamlPath=void 0;var hon=Rht(require("path")),lY=fon(Hr()),don=Rht(yl()),mon=ar(),gon=Hr();function von(){let e=lY.getYamlPath("s");if(e)return hon.default.resolve(e);throw new lY.DevsError("the s.yaml/s.yml file was not found.",{tips:"Please check if the s.yaml/s.yml file exists, you can also specify it with -t.",trackerType:gon.ETrackerType.parseException})}na.getDefaultYamlPath=von;var Don=(e,t)=>typeof e!="string"?!1:(lY.getYamlContent(lY.getAbsolutePath(e,t)),!0);na.isExtendMode=Don;function yon(e,t){return pon(this,void 0,void 0,function*(){try{let n=yield new don.default({logger:t}).get(e);return(0,mon.get)(n,"credential",{})}catch{return{}}})}na.getCredential=yon});var Ege=L((QCu,Iht)=>{function Eon(e){r.debug=r,r.default=r,r.coerce=a,r.disable=i,r.enable=u,r.enabled=o,r.humanize=Y$(),r.destroy=c,Object.keys(e).forEach(l=>{r[l]=e[l]}),r.names=[],r.skips=[],r.formatters={};function t(l){let f=0;for(let p=0;p<l.length;p++)f=(f<<5)-f+l.charCodeAt(p),f|=0;return r.colors[Math.abs(f)%r.colors.length]}r.selectColor=t;function r(l){let f,p=null,h,d;function m(...v){if(!m.enabled)return;let y=m,g=Number(new Date),D=g-(f||g);y.diff=D,y.prev=f,y.curr=g,f=g,v[0]=r.coerce(v[0]),typeof v[0]!="string"&&v.unshift("%O");let E=0;v[0]=v[0].replace(/%([a-zA-Z%])/g,(C,x)=>{if(C==="%%")return"%";E++;let F=r.formatters[x];if(typeof F=="function"){let A=v[E];C=F.call(y,A),v.splice(E,1),E--}return C}),r.formatArgs.call(y,v),(y.log||r.log).apply(y,v)}return m.namespace=l,m.useColors=r.useColors(),m.color=r.selectColor(l),m.extend=n,m.destroy=r.destroy,Object.defineProperty(m,"enabled",{enumerable:!0,configurable:!1,get:()=>p!==null?p:(h!==r.namespaces&&(h=r.namespaces,d=r.enabled(l)),d),set:v=>{p=v}}),typeof r.init=="function"&&r.init(m),m}function n(l,f){let p=r(this.namespace+(typeof f>"u"?":":f)+l);return p.log=this.log,p}function u(l){r.save(l),r.namespaces=l,r.names=[],r.skips=[];let f,p=(typeof l=="string"?l:"").split(/[\s,]+/),h=p.length;for(f=0;f<h;f++)p[f]&&(l=p[f].replace(/\*/g,".*?"),l[0]==="-"?r.skips.push(new RegExp("^"+l.slice(1)+"$")):r.names.push(new RegExp("^"+l+"$")))}function i(){let l=[...r.names.map(s),...r.skips.map(s).map(f=>"-"+f)].join(",");return r.enable(""),l}function o(l){if(l[l.length-1]==="*")return!0;let f,p;for(f=0,p=r.skips.length;f<p;f++)if(r.skips[f].test(l))return!1;for(f=0,p=r.names.length;f<p;f++)if(r.names[f].test(l))return!0;return!1}function s(l){return l.toString().substring(2,l.toString().length-2).replace(/\.\*\?$/,"*")}function a(l){return l instanceof Error?l.stack||l.message:l}function c(){console.warn("Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`.")}return r.enable(r.load()),r}Iht.exports=Eon});var jht=L((D0,fY)=>{D0.formatArgs=Con;D0.save=xon;D0.load=Aon;D0.useColors=bon;D0.storage=Fon();D0.destroy=(()=>{let e=!1;return()=>{e||(e=!0,console.warn("Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`."))}})();D0.colors=["#0000CC","#0000FF","#0033CC","#0033FF","#0066CC","#0066FF","#0099CC","#0099FF","#00CC00","#00CC33","#00CC66","#00CC99","#00CCCC","#00CCFF","#3300CC","#3300FF","#3333CC","#3333FF","#3366CC","#3366FF","#3399CC","#3399FF","#33CC00","#33CC33","#33CC66","#33CC99","#33CCCC","#33CCFF","#6600CC","#6600FF","#6633CC","#6633FF","#66CC00","#66CC33","#9900CC","#9900FF","#9933CC","#9933FF","#99CC00","#99CC33","#CC0000","#CC0033","#CC0066","#CC0099","#CC00CC","#CC00FF","#CC3300","#CC3333","#CC3366","#CC3399","#CC33CC","#CC33FF","#CC6600","#CC6633","#CC9900","#CC9933","#CCCC00","#CCCC33","#FF0000","#FF0033","#FF0066","#FF0099","#FF00CC","#FF00FF","#FF3300","#FF3333","#FF3366","#FF3399","#FF33CC","#FF33FF","#FF6600","#FF6633","#FF9900","#FF9933","#FFCC00","#FFCC33"];function bon(){return typeof window<"u"&&window.process&&(window.process.type==="renderer"||window.process.__nwjs)?!0:typeof navigator<"u"&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/(edge|trident)\/(\d+)/)?!1:typeof document<"u"&&document.documentElement&&document.documentElement.style&&document.documentElement.style.WebkitAppearance||typeof window<"u"&&window.console&&(window.console.firebug||window.console.exception&&window.console.table)||typeof navigator<"u"&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/firefox\/(\d+)/)&&parseInt(RegExp.$1,10)>=31||typeof navigator<"u"&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/applewebkit\/(\d+)/)}function Con(e){if(e[0]=(this.useColors?"%c":"")+this.namespace+(this.useColors?" %c":" ")+e[0]+(this.useColors?"%c ":" ")+"+"+fY.exports.humanize(this.diff),!this.useColors)return;let t="color: "+this.color;e.splice(1,0,t,"color: inherit");let r=0,n=0;e[0].replace(/%[a-zA-Z%]/g,u=>{u!=="%%"&&(r++,u==="%c"&&(n=r))}),e.splice(n,0,t)}D0.log=console.debug||console.log||(()=>{});function xon(e){try{e?D0.storage.setItem("debug",e):D0.storage.removeItem("debug")}catch{}}function Aon(){let e;try{e=D0.storage.getItem("debug")}catch{}return!e&&typeof process<"u"&&"env"in process&&(e=process.env.DEBUG),e}function Fon(){try{return localStorage}catch{}}fY.exports=Ege()(D0);var{formatters:_on}=fY.exports;_on.j=function(e){try{return JSON.stringify(e)}catch(t){return"[UnexpectedJSONParseError]: "+t.message}}});var Nht=L((Ka,hY)=>{var Bon=require("tty"),pY=require("util");Ka.init=Ron;Ka.log=Ton;Ka.formatArgs=Son;Ka.save=Pon;Ka.load=kon;Ka.useColors=won;Ka.destroy=pY.deprecate(()=>{},"Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`.");Ka.colors=[6,2,3,4,5,1];try{let e=f0();e&&(e.stderr||e).level>=2&&(Ka.colors=[20,21,26,27,32,33,38,39,40,41,42,43,44,45,56,57,62,63,68,69,74,75,76,77,78,79,80,81,92,93,98,99,112,113,128,129,134,135,148,149,160,161,162,163,164,165,166,167,168,169,170,171,172,173,178,179,184,185,196,197,198,199,200,201,202,203,204,205,206,207,208,209,214,215,220,221])}catch{}Ka.inspectOpts=Object.keys(process.env).filter(e=>/^debug_/i.test(e)).reduce((e,t)=>{let r=t.substring(6).toLowerCase().replace(/_([a-z])/g,(u,i)=>i.toUpperCase()),n=process.env[t];return/^(yes|on|true|enabled)$/i.test(n)?n=!0:/^(no|off|false|disabled)$/i.test(n)?n=!1:n==="null"?n=null:n=Number(n),e[r]=n,e},{});function won(){return"colors"in Ka.inspectOpts?!!Ka.inspectOpts.colors:Bon.isatty(process.stderr.fd)}function Son(e){let{namespace:t,useColors:r}=this;if(r){let n=this.color,u="\x1B[3"+(n<8?n:"8;5;"+n),i=` ${u};1m${t} \x1B[0m`;e[0]=i+e[0].split(`
207
207
  `).join(`
208
208
  `+i),e.push(u+"m+"+hY.exports.humanize(this.diff)+"\x1B[0m")}else e[0]=Oon()+t+" "+e[0]}function Oon(){return Ka.inspectOpts.hideDate?"":new Date().toISOString()+" "}function Ton(...e){return console.log(pY.format(...e))}function Pon(e){e?process.env.DEBUG=e:delete process.env.DEBUG}function kon(){return process.env.DEBUG}function Ron(e){e.inspectOpts={};let t=Object.keys(Ka.inspectOpts);for(let r=0;r<t.length;r++)e.inspectOpts[t[r]]=Ka.inspectOpts[t[r]]}hY.exports=Ege()(Ka);var{formatters:Lht}=hY.exports;Lht.o=function(e){return this.inspectOpts.colors=this.useColors,pY.inspect(e,this.inspectOpts).split(`
209
- `).map(t=>t.trim()).join(" ")};Lht.O=function(e){return this.inspectOpts.colors=this.useColors,pY.inspect(e,this.inspectOpts)}});var ed=L((ZCu,bge)=>{typeof process>"u"||process.type==="renderer"||process.browser===!0||process.__nwjs?bge.exports=jht():bge.exports=Nht()});var Mht=L(Age=>{"use strict";Object.defineProperty(Age,"__esModule",{value:!0});var y0=ar(),qht=t$(),Cge=ed()("serverless-devs:parse-spec"),xge=class{constructor(t){this.steps=t,this.useOrder=!1,this.orderMap={},this.dependencies={}}start(){return this.dependencies=this.getDependencies(),this.analysis(),this}sort(t){if(!this.useOrder)return{steps:t,dependencies:this.dependencies};let r=(0,y0.map)(t,u=>Object.assign(Object.assign({},u),{order:this.orderMap[u.projectName]}));return{steps:(0,y0.sortBy)(r,u=>u.order),dependencies:this.dependencies,useOrder:this.useOrder}}analysis(){let t=(0,y0.cloneDeep)(this.dependencies),r=0,n=()=>{for(let u in t){let i=t[u];if((0,y0.isEmpty)(i)){(0,y0.set)(this.orderMap,u,r++),(0,y0.unset)(t,u);for(let o in t)(0,y0.unset)(t,[o,u]);n()}}};n(),Cge(`order map: ${JSON.stringify(this.orderMap)}`)}getDependencies(){Cge(`order steps: ${JSON.stringify(this.steps)}`);let t=(0,y0.map)(this.steps,i=>i.projectName),r={},n="",u=i=>{let o=i.constructor===Array?[]:{};if(typeof i=="object")for(var s in i){let a=i[s];if(typeof a=="string"){let c=a.match(qht.REGXG);if(c)for(let l of c){let f=l.replace(qht.REGXG,"$1"),p=(0,y0.split)(f,".")[1];(0,y0.includes)(t,p)&&(this.useOrder=!0,(0,y0.set)(r,n,Object.assign(Object.assign({},r[n]),{[p]:1})))}}o[s]=typeof a=="object"?u(a):a}else o=i;return o};for(let i of this.steps)n=i.projectName,(0,y0.set)(r,n,{}),u((0,y0.get)(i,"props",{}));return Cge(`order dependencies: ${JSON.stringify(r)}`),r}};Age.default=xge});var _ge=L((txu,$ht)=>{"use strict";var Fge=Object.prototype.hasOwnProperty,Ion=Object.prototype.toString,Uht=function(t){if(!t||Ion.call(t)!=="[object Object]")return!1;var r=Fge.call(t,"constructor"),n=t.constructor&&t.constructor.prototype&&Fge.call(t.constructor.prototype,"isPrototypeOf");if(t.constructor&&!r&&!n)return!1;var u;for(u in t);return typeof u>"u"||Fge.call(t,u)};$ht.exports=function e(){var t,r,n,u,i,o,s=arguments[0],a=1,c=arguments.length,l=!1;for(typeof s=="boolean"?(l=s,s=arguments[1]||{},a=2):(typeof s!="object"&&typeof s!="function"||s==null)&&(s={});a<c;++a)if(t=arguments[a],t!=null)for(r in t)r!=="__proto__"&&(n=s[r],u=t[r],s!==u&&(l&&u&&Uht(u)?(o=n&&Uht(n)?n:{},s[r]=e(l,o,u)):typeof u<"u"&&(s[r]=u)));return s}});var Hht=L(Km=>{"use strict";var zht=Km&&Km.__awaiter||function(e,t,r,n){function u(i){return i instanceof r?i:new r(function(o){o(i)})}return new(r||(r=Promise))(function(i,o){function s(l){try{c(n.next(l))}catch(f){o(f)}}function a(l){try{c(n.throw(l))}catch(f){o(f)}}function c(l){l.done?i(l.value):u(l.value).then(s,a)}c((n=n.apply(e,t||[])).next())})},jon=Km&&Km.__rest||function(e,t){var r={};for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&t.indexOf(n)<0&&(r[n]=e[n]);if(e!=null&&typeof Object.getOwnPropertySymbols=="function")for(var u=0,n=Object.getOwnPropertySymbols(e);u<n.length;u++)t.indexOf(n[u])<0&&Object.prototype.propertyIsEnumerable.call(e,n[u])&&(r[n[u]]=e[n[u]]);return r},Vht=Km&&Km.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(Km,"__esModule",{value:!0});var Lon=Vht(require("path")),eT=Vht(Rhe()),Non=yge(),hi=ar(),qon=e$(),Wht=_ge(),Ght=ed()("serverless-devs:parse-spec"),Bge=class{constructor(t={},r={}){this.content=t,this.options=r,this.credential={}}start(){return zht(this,void 0,void 0,function*(){return yield this.getSteps()})}getEnvMagic(t={}){return Object.assign(Object.assign({},t),{__runtime:"parse",project:(0,hi.get)(this.options.environment,"__project"),that:(0,hi.set)((0,hi.omit)(this.options.environment,["infrastructure","overlays"]),"project",(0,hi.get)(this.options.environment,"__project")),credential:this.credential})}getCommonMagic(){return{cwd:Lon.default.dirname(this.options.basePath),vars:this.content.vars,__runtime:"parse",credential:this.credential}}getMagicProps(t){let r=(0,hi.get)(this.content,"resources",{}),n={};(0,hi.each)(r,(o,s)=>{(0,hi.set)(n,`${s}.props`,o.props||{})});let u=t.projectName,i=Object.assign(Object.assign({},this.getCommonMagic()),{resources:n,that:{name:u,access:t.access,component:t.component,props:n[u].props,output:n[u].output}});return(0,hi.set)(i,"that.props",(0,eT.default)(n[u].props,i)),Ght(`getMagicProps: ${JSON.stringify(i)}`),i}getSteps(){return zht(this,void 0,void 0,function*(){let t=this.getAccess();this.credential=yield(0,Non.getCredential)(t,this.options.logger);let r=this.content,{resources:n}=r,u=jon(r,["resources"]);this.content=Object.assign(Object.assign({},this.content),(0,eT.default)(u,this.getCommonMagic()));let i=[],o=[],s=this.options.projectName?{[this.options.projectName]:n[this.options.projectName]}:n;for(let a in s){let c=n[a],l=qon((0,hi.get)(c,"component"),this.getCommonMagic()),f=(0,hi.get)(this.content.template,(0,hi.get)(c,"extend.name"),{});f=(0,eT.default)((0,hi.omit)(f,(0,hi.get)(c,"extend.ignore",[])),this.getCommonMagic());let p=Wht(!0,{},f,c.props),h=(0,hi.cloneDeep)(this.options.environment);h&&!(0,hi.isEmpty)((0,hi.get)(h,"overlays.components"))&&(h.overlays.components=(0,hi.pickBy)(h.overlays.components,(y,g)=>g===l)),h&&!(0,hi.isEmpty)((0,hi.get)(h,"overlays.resources"))&&(h.overlays.resources=(0,hi.pickBy)(h.overlays.resources,(y,g)=>g===a));let d=(0,eT.default)(h,this.getEnvMagic({source:p})),m=(0,hi.get)(d,"infraStack.region")?{region:(0,hi.get)(d,"infraStack.region")}:{};Ght(`real environment: ${JSON.stringify(d)}`),(0,hi.set)(c,"props",Wht(!0,{},p,(0,hi.get)(d,`overlays.components.${l}`,{}),(0,hi.get)(d,`overlays.resources.${a}`,{}),m));let v=(0,eT.default)(c,this.getMagicProps({projectName:a,access:t,component:l}));this.content=Object.assign(Object.assign({},this.content),{access:t,resources:Object.assign(Object.assign({},this.content.resources),{[a]:v})}),i.push(Object.assign(Object.assign({},v),{projectName:a,component:l,access:t,credential:this.credential})),o.push(Object.assign(Object.assign({},c),{projectName:a,component:l,access:t,credential:this.credential}))}return{steps:i,content:this.content,originSteps:o}})}getAccess(){if(this.options.access)return this.options.access;let t=(0,hi.get)(this.options,"environment.access");return t||(this.content.access?this.content.access:"default")}};Km.default=Bge});var E0=L(No=>{"use strict";var Jht=No&&No.__createBinding||(Object.create?function(e,t,r,n){n===void 0&&(n=r);var u=Object.getOwnPropertyDescriptor(t,r);(!u||("get"in u?!t.__esModule:u.writable||u.configurable))&&(u={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,n,u)}:function(e,t,r,n){n===void 0&&(n=r),e[n]=t[r]}),Mon=No&&No.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),Qht=No&&No.__exportStar||function(e,t){for(var r in e)r!=="default"&&!Object.prototype.hasOwnProperty.call(t,r)&&Jht(t,e,r)},Uon=No&&No.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(e!=null)for(var r in e)r!=="default"&&Object.prototype.hasOwnProperty.call(e,r)&&Jht(t,e,r);return Mon(t,e),t},wge=No&&No.__awaiter||function(e,t,r,n){function u(i){return i instanceof r?i:new r(function(o){o(i)})}return new(r||(r=Promise))(function(i,o){function s(l){try{c(n.next(l))}catch(f){o(f)}}function a(l){try{c(n.throw(l))}catch(f){o(f)}}function c(l){l.done?i(l.value):u(l.value).then(s,a)}c((n=n.apply(e,t||[])).next())})},tT=No&&No.__rest||function(e,t){var r={};for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&t.indexOf(n)<0&&(r[n]=e[n]);if(e!=null&&typeof Object.getOwnPropertySymbols=="function")for(var u=0,n=Object.getOwnPropertySymbols(e);u<n.length;u++)t.indexOf(n[u])<0&&Object.prototype.propertyIsEnumerable.call(e,n[u])&&(r[n[u]]=e[n[u]]);return r},Wy=No&&No.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(No,"__esModule",{value:!0});No.getInputs=void 0;var $on=Rhe();Object.defineProperty(No,"getInputs",{enumerable:!0,get:function(){return Wy($on).default}});Qht(Ihe(),No);Qht(t$(),No);var Sp=Uon(Hr()),Sge=Wy(ro()),N1=Wy(require("path")),Oge=Wy(qhe()),Tge=Mhe(),Kht=yge(),Yht=e$(),zon=Wy(Mht()),Pge=Wy(Hht()),Qr=ar(),zy=Ihe(),Ym=t$(),Won=Wy(require("assert")),ua=Hr(),Xht=_ge(),Ef=ed()("serverless-devs:parse-spec"),kge=class{constructor(t="",r={}){this.options=r,this.yaml={},this.record={},this.options.argv=this.options.argv||process.argv.slice(2),this.options.logger=this.options.logger||console,this.init(t),Ef(`yaml path: ${this.yaml.path}`),Ef(`argv: ${JSON.stringify(this.options.argv)}`)}init(t){if((0,Qr.isEmpty)(t))return this.yaml.path=(0,Kht.getDefaultYamlPath)();if(Sge.default.existsSync(t))return this.yaml.path=Sp.getAbsolutePath(t);throw new Error(`The specified template file does not exist: ${t}`)}doYamlinit(){return wge(this,void 0,void 0,function*(){yield this.doExtend(),this.doEnvironment(),this.yaml.access=(0,Qr.get)(this.yaml.content,"access");let t=this.yaml.use3x?"resources":"services",r=(0,Qr.get)(this.yaml.content,t,{});this.yaml.projectNames=(0,Qr.keys)((0,Qr.get)(this.yaml.content,t,{})),this.yaml.vars=(0,Qr.get)(this.yaml.content,"vars",{}),this.yaml.flow=(0,Qr.get)(this.yaml.content,"flow",{}),this.yaml.useFlow=!1,this.yaml.appName=(0,Qr.get)(this.yaml.content,"name");for(let n of this.yaml.projectNames)if((0,Qr.get)(r,`${n}.props.code`)){let u=Sp.getAbsolutePath((0,Qr.get)(r,`${n}.props.code`,""));(0,Tge.expand)(Oge.default.config({path:N1.default.join(u,".env")}))}(0,Tge.expand)(Oge.default.config({path:N1.default.join(N1.default.dirname(this.yaml.path),".env")}))})}doExtend(){return wge(this,void 0,void 0,function*(){if(this.yaml.content=Sp.getYamlContent(this.yaml.path),this.yaml.extend=(0,Qr.get)(this.yaml.content,"extend"),this.yaml.useExtend=(0,Kht.isExtendMode)(this.yaml.extend,N1.default.dirname(this.yaml.path)),this.yaml.useExtend){let t=Sp.getAbsolutePath(this.yaml.extend,N1.default.dirname(this.yaml.path));(0,Tge.expand)(Oge.default.config({path:N1.default.join(t,".env")}));let r=Sp.getYamlContent(t);if(this.yaml.use3x=String((0,Qr.get)(this.yaml.content,"edition",(0,Qr.get)(r,"edition")))==="3.0.0",!this.yaml.use3x)return;let{resources:n}=r,u=tT(r,["resources"]),i=this.yaml.content,{resources:o}=i,s=tT(i,["resources"]),a=Xht(!0,{},u,s),c=yield new Pge.default(Object.assign(Object.assign({},r),a),this.getParsedContentOptions(t)).start(),l=yield new Pge.default(Object.assign(Object.assign({},this.yaml.content),a),this.getParsedContentOptions(this.yaml.path)).start();this.yaml.content=Xht(!0,{},(0,Qr.get)(c,"content"),(0,Qr.get)(l,"content"));return}this.yaml.use3x=String((0,Qr.get)(this.yaml.content,"edition"))==="3.0.0"})}doEnvironment(){if(!this.yaml.use3x)return;let t=this.record.env?this.doEnvWithSpecify():this.doEnvWithNotSpecify();if((0,Qr.isEmpty)(t))return;let{project:r,environment:n}=t;Ef(`use environment: ${JSON.stringify(n)}`),(0,Qr.set)(n,"overlays.resources.region",(0,Qr.get)(n,"region")),(0,Qr.set)(n,"__project",r),this.yaml.environment=n}doEnvWithNotSpecify(){if(this.yaml.useExtend&&(0,Qr.has)(this.yaml.content,Ym.ENVIRONMENT_KEY))throw new ua.DevsError("Environment and extend is conflict",{trackerType:ua.ETrackerType.parseException});if((0,Qr.has)(this.yaml.content,Ym.ENVIRONMENT_KEY)){let t=Sp.getAbsolutePath((0,Qr.get)(this.yaml.content,Ym.ENVIRONMENT_KEY),N1.default.dirname(this.yaml.path)),r=Sp.getYamlContent(t);if((0,Qr.isEmpty)(r))throw new ua.DevsError(`Environment file [${t}] is not found`,{tips:"You can create a new environment file by running `s env init`",trackerType:ua.ETrackerType.parseException});if(!Sge.default.existsSync(Ym.ENVIRONMENT_FILE_PATH))throw new ua.DevsError("Default env is not found",{tips:"You can set a default environment by running `s env default`",trackerType:ua.ETrackerType.parseException});let{project:n,environments:u}=r,i=require(Ym.ENVIRONMENT_FILE_PATH),o=(0,Qr.get)((0,Qr.find)(i,{project:n}),"default");if(!o)throw new ua.DevsError("Default env is not found",{tips:"You can set a default environment by running `s env default`",trackerType:ua.ETrackerType.parseException});let s=(0,Qr.find)(u,a=>a.name===o);if((0,Qr.isEmpty)(s))throw new ua.DevsError(`Default env [${o}] was not found`,{trackerType:ua.ETrackerType.parseException});return{project:n,environment:s}}}doEnvWithSpecify(){if(this.yaml.useExtend)throw new ua.DevsError("Environment and extend is conflict",{trackerType:ua.ETrackerType.parseException});let t=Sp.getAbsolutePath((0,Qr.get)(this.yaml.content,Ym.ENVIRONMENT_KEY,Ym.ENVIRONMENT_FILE_NAME),N1.default.dirname(this.yaml.path)),r=Sp.getYamlContent(t);if((0,Qr.isEmpty)(r))throw new ua.DevsError(`Environment file [${t}] is not exist`,{trackerType:ua.ETrackerType.parseException});Ef(`environment content: ${JSON.stringify(r)}`);let{project:n,environments:u}=r,i=(0,Qr.find)(u,o=>o.name===this.record.env);if((0,Qr.isEmpty)(i))throw new ua.DevsError(`Env [${this.record.env}] was not found`,{trackerType:ua.ETrackerType.parseException});return{project:n,environment:i}}getParsedContentOptions(t){return{logger:this.options.logger,basePath:t,projectName:this.record.projectName,access:this.record.access,environment:this.yaml.environment}}start(){return wge(this,void 0,void 0,function*(){if(Ef("parse start"),this.parseArgv(),yield this.doYamlinit(),this.parseArgv(),!this.yaml.use3x)return this.v1();let{steps:t,content:r,originSteps:n}=yield new Pge.default(this.yaml.content,this.getParsedContentOptions(this.yaml.path)).start();this.yaml.content=r,this.yaml.vars=(0,Qr.get)(this.yaml.content,"vars",{});let u=(0,Qr.get)(this.yaml.content,"actions",{});this.yaml.actions=this.parseActions(u);let i=Object.assign({steps:this.record.projectName?t:this.doFlow(t,n),yaml:this.yaml},this.record);return Ef(`parse result: ${JSON.stringify(i)}`),Ef("parse end"),i})}v1(){let t=[],r=(0,Qr.get)(this.yaml.content,"services",{});for(let n in r){let u=r[n];t.push(Object.assign(Object.assign({},u),{projectName:n}))}return Object.assign({steps:this.record.projectName?(0,Qr.filter)(t,n=>n.projectName===this.record.projectName):t,yaml:this.yaml},this.record)}parseArgv(){let t=Sp.parseArgv(this.options.argv);Ef(`parse argv: ${JSON.stringify(t)}`);let{_:r}=t;if(this.record.access=(0,Qr.get)(t,"access"),this.record.version=(0,Qr.get)(t,"version"),this.record.help=(0,Qr.get)(t,"help"),this.record.output=(0,Qr.get)(t,"output"),this.record.skipActions=(0,Qr.get)(t,"skip-actions"),this.record.debug=(0,Qr.get)(t,"debug"),this.record.env=(0,Qr.get)(t,"env"),(0,Qr.includes)(this.yaml.projectNames,r[0])){this.record.projectName=r[0],this.record.command=r[1];return}this.record.command=r[0]}doFlow(t,r){let n=[],u=(0,Qr.find)(this.yaml.flow,(f,p)=>this.matchFlow(p)),i=new zon.default(r).start(),{steps:o,dependencies:s,useOrder:a}=i.sort(t);if(!u)return o;Ef(`find flow: ${JSON.stringify(u)}`);let c={},l=(f=[],p)=>{(0,Won.default)((0,Qr.isArray)(f),`flow ${this.record.command} data format is invalid`);for(let h of f)for(let d of t)h===d.projectName&&(n.push(Object.assign(Object.assign({},d),{flowId:p})),c[d.projectName]=p)};if((0,Qr.each)(u,l),Ef(`flow steps: ${JSON.stringify(n)}`),this.yaml.useFlow=!0,Ef(`flow projectOrder: ${JSON.stringify(c)}`),a){Ef(`project dependencies: ${JSON.stringify(s)}`);for(let f in s){let p=s[f];for(let h in p)if(c[h]>=c[f])throw new Error(`flow is invalid, ${h} must be executed before ${f}`)}}return n}matchFlow(t){return Ym.REGX.test(t)?Yht(t,{command:this.record.command}):t===this.record.command}parseActions(t={},r=zy.IActionLevel.GLOBAL){let n=[];for(let u in t){let i=t[u];if(!(0,Qr.isArray)(i))throw new ua.DevsError(`${r} action ${u} is invalid, it must be array`,{trackerType:ua.ETrackerType.parseException});let o=this.matchAction(u);Ef(`action: ${u}, useAction: ${JSON.stringify(o)}`),o.validate&&n.push(...(0,Qr.map)(i,s=>{if(s[zy.IActionType.RUN]){let{run:a}=s,c=tT(s,["run"]);return Object.assign(Object.assign({},c),{value:a,path:Sp.getAbsolutePath((0,Qr.get)(s,"path","./"),N1.default.dirname(this.yaml.path)),actionType:zy.IActionType.RUN,hookType:o.type,level:r,projectName:this.record.projectName})}if(s[zy.IActionType.PLUGIN]){let{plugin:a}=s,c=tT(s,["plugin"]),l=Sp.getAbsolutePath(a,N1.default.dirname(this.yaml.path));return Object.assign(Object.assign({},c),{value:Sge.default.existsSync(l)?l:a,actionType:zy.IActionType.PLUGIN,hookType:o.type,level:r,projectName:this.record.projectName})}if(s[zy.IActionType.COMPONENT]){let{component:a}=s,c=tT(s,["component"]);return Object.assign(Object.assign({},c),{value:a,actionType:zy.IActionType.COMPONENT,hookType:o.type,level:r,projectName:this.record.projectName})}}))}return Ef(`parse actions: ${JSON.stringify(n)}`),n}matchAction(t){if(Ym.REGX.test(t)){let i=Yht(t,{command:this.record.command}),[o,s]=(0,Qr.split)(i,"-");return{validate:s==="true",type:o}}let[n,u]=(0,Qr.split)(t,"-");return{validate:u===this.record.command,type:n}}};No.default=kge});var rT=L((uxu,rdt)=>{var Gon=require("path").relative;rdt.exports=Xon;var Von=process.cwd();function edt(e,t){for(var r=e.split(/[ ,]+/),n=String(t).toLowerCase(),u=0;u<r.length;u++){var i=r[u];if(i&&(i==="*"||i.toLowerCase()===n))return!0}return!1}function Hon(e,t,r){var n=Object.getOwnPropertyDescriptor(e,t),u=n.value;return n.get=function(){return u},n.writable&&(n.set=function(o){return u=o}),delete n.value,delete n.writable,Object.defineProperty(e,t,n),n}function Kon(e){for(var t="",r=0;r<e;r++)t+=", arg"+r;return t.substr(2)}function Yon(e){var t=this.name+": "+this.namespace;this.message&&(t+=" deprecated "+this.message);for(var r=0;r<e.length;r++)t+=`
209
+ `).map(t=>t.trim()).join(" ")};Lht.O=function(e){return this.inspectOpts.colors=this.useColors,pY.inspect(e,this.inspectOpts)}});var ed=L((ZCu,bge)=>{typeof process>"u"||process.type==="renderer"||process.browser===!0||process.__nwjs?bge.exports=jht():bge.exports=Nht()});var Mht=L(Age=>{"use strict";Object.defineProperty(Age,"__esModule",{value:!0});var y0=ar(),qht=t$(),Cge=ed()("serverless-devs:parse-spec"),xge=class{constructor(t){this.steps=t,this.useOrder=!1,this.orderMap={},this.dependencies={}}start(){return this.dependencies=this.getDependencies(),this.analysis(),this}sort(t){if(!this.useOrder)return{steps:t,dependencies:this.dependencies};let r=(0,y0.map)(t,u=>Object.assign(Object.assign({},u),{order:this.orderMap[u.projectName]}));return{steps:(0,y0.sortBy)(r,u=>u.order),dependencies:this.dependencies,useOrder:this.useOrder}}analysis(){let t=(0,y0.cloneDeep)(this.dependencies),r=0,n=()=>{for(let u in t){let i=t[u];if((0,y0.isEmpty)(i)){(0,y0.set)(this.orderMap,u,r++),(0,y0.unset)(t,u);for(let o in t)(0,y0.unset)(t,[o,u]);n()}}};n(),Cge(`order map: ${JSON.stringify(this.orderMap)}`)}getDependencies(){Cge(`order steps: ${JSON.stringify(this.steps)}`);let t=(0,y0.map)(this.steps,i=>i.projectName),r={},n="",u=i=>{let o=i.constructor===Array?[]:{};if(typeof i=="object")for(var s in i){let a=i[s];if(typeof a=="string"){let c=a.match(qht.REGXG);if(c)for(let l of c){let f=l.replace(qht.REGXG,"$1"),p=(0,y0.split)(f,".")[1];(0,y0.includes)(t,p)&&(this.useOrder=!0,(0,y0.set)(r,n,Object.assign(Object.assign({},r[n]),{[p]:1})))}}o[s]=typeof a=="object"?u(a):a}else o=i;return o};for(let i of this.steps)n=i.projectName,(0,y0.set)(r,n,{}),u((0,y0.get)(i,"props",{}));return Cge(`order dependencies: ${JSON.stringify(r)}`),r}};Age.default=xge});var _ge=L((txu,$ht)=>{"use strict";var Fge=Object.prototype.hasOwnProperty,Ion=Object.prototype.toString,Uht=function(t){if(!t||Ion.call(t)!=="[object Object]")return!1;var r=Fge.call(t,"constructor"),n=t.constructor&&t.constructor.prototype&&Fge.call(t.constructor.prototype,"isPrototypeOf");if(t.constructor&&!r&&!n)return!1;var u;for(u in t);return typeof u>"u"||Fge.call(t,u)};$ht.exports=function e(){var t,r,n,u,i,o,s=arguments[0],a=1,c=arguments.length,l=!1;for(typeof s=="boolean"?(l=s,s=arguments[1]||{},a=2):(typeof s!="object"&&typeof s!="function"||s==null)&&(s={});a<c;++a)if(t=arguments[a],t!=null)for(r in t)r!=="__proto__"&&(n=s[r],u=t[r],s!==u&&(l&&u&&Uht(u)?(o=n&&Uht(n)?n:{},s[r]=e(l,o,u)):typeof u<"u"&&(s[r]=u)));return s}});var Hht=L(Km=>{"use strict";var zht=Km&&Km.__awaiter||function(e,t,r,n){function u(i){return i instanceof r?i:new r(function(o){o(i)})}return new(r||(r=Promise))(function(i,o){function s(l){try{c(n.next(l))}catch(f){o(f)}}function a(l){try{c(n.throw(l))}catch(f){o(f)}}function c(l){l.done?i(l.value):u(l.value).then(s,a)}c((n=n.apply(e,t||[])).next())})},jon=Km&&Km.__rest||function(e,t){var r={};for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&t.indexOf(n)<0&&(r[n]=e[n]);if(e!=null&&typeof Object.getOwnPropertySymbols=="function")for(var u=0,n=Object.getOwnPropertySymbols(e);u<n.length;u++)t.indexOf(n[u])<0&&Object.prototype.propertyIsEnumerable.call(e,n[u])&&(r[n[u]]=e[n[u]]);return r},Vht=Km&&Km.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(Km,"__esModule",{value:!0});var Lon=Vht(require("path")),eT=Vht(Rhe()),Non=yge(),hi=ar(),qon=e$(),Wht=_ge(),Ght=ed()("serverless-devs:parse-spec"),Bge=class{constructor(t={},r={}){this.content=t,this.options=r,this.credential={}}start(){return zht(this,void 0,void 0,function*(){return yield this.getSteps()})}getEnvMagic(t={}){return Object.assign(Object.assign({},t),{__runtime:"parse",project:(0,hi.get)(this.options.environment,"__project"),that:(0,hi.set)((0,hi.omit)(this.options.environment,["infrastructure","overlays"]),"project",(0,hi.get)(this.options.environment,"__project")),credential:this.credential})}getCommonMagic(){return{cwd:Lon.default.dirname(this.options.basePath),vars:this.content.vars,__runtime:"parse",credential:this.credential}}getMagicProps(t){let r=(0,hi.get)(this.content,"resources",{}),n={};(0,hi.each)(r,(o,s)=>{(0,hi.set)(n,`${s}.props`,o.props||{})});let u=t.projectName,i=Object.assign(Object.assign({},this.getCommonMagic()),{resources:n,that:{name:u,access:t.access,component:t.component,props:n[u].props,output:n[u].output}});return(0,hi.set)(i,"that.props",(0,eT.default)(n[u].props,i)),Ght(`getMagicProps: ${JSON.stringify(i)}`),i}getSteps(){return zht(this,void 0,void 0,function*(){let t=this.getAccess();this.credential=yield(0,Non.getCredential)(t,this.options.logger);let r=this.content,{resources:n}=r,u=jon(r,["resources"]);this.content=Object.assign(Object.assign({},this.content),(0,eT.default)(u,this.getCommonMagic()));let i=[],o=[],s=this.options.projectName?{[this.options.projectName]:n[this.options.projectName]}:n;for(let a in s){let c=n[a],l=qon((0,hi.get)(c,"component"),this.getCommonMagic()),f=(0,hi.get)(this.content.template,(0,hi.get)(c,"extend.name"),{});f=(0,eT.default)((0,hi.omit)(f,(0,hi.get)(c,"extend.ignore",[])),this.getCommonMagic());let p=Wht(!0,{},f,c.props),h=(0,hi.cloneDeep)(this.options.environment);h&&!(0,hi.isEmpty)((0,hi.get)(h,"overlays.components"))&&(h.overlays.components=(0,hi.pickBy)(h.overlays.components,(y,g)=>g===l)),h&&!(0,hi.isEmpty)((0,hi.get)(h,"overlays.resources"))&&(h.overlays.resources=(0,hi.pickBy)(h.overlays.resources,(y,g)=>g===a));let d=(0,eT.default)(h,this.getEnvMagic({source:p})),m=(0,hi.get)(d,"infraStack.region")?{region:(0,hi.get)(d,"infraStack.region")}:{};Ght(`real environment: ${JSON.stringify(d)}`),(0,hi.set)(c,"props",Wht(!0,{},p,(0,hi.get)(d,`overlays.components.${l}`,{}),(0,hi.get)(d,`overlays.resources.${a}`,{}),m));let v=(0,eT.default)(c,this.getMagicProps({projectName:a,access:t,component:l}));this.content=Object.assign(Object.assign({},this.content),{access:t,resources:Object.assign(Object.assign({},this.content.resources),{[a]:v})}),i.push(Object.assign(Object.assign({},v),{projectName:a,component:l,access:t,credential:this.credential})),o.push(Object.assign(Object.assign({},c),{projectName:a,component:l,access:t,credential:this.credential}))}return{steps:i,content:this.content,originSteps:o}})}getAccess(){if(this.options.access)return this.options.access;let t=(0,hi.get)(this.options,"environment.access");if(t)return t;if(this.content.access)return this.content.access}};Km.default=Bge});var E0=L(No=>{"use strict";var Jht=No&&No.__createBinding||(Object.create?function(e,t,r,n){n===void 0&&(n=r);var u=Object.getOwnPropertyDescriptor(t,r);(!u||("get"in u?!t.__esModule:u.writable||u.configurable))&&(u={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,n,u)}:function(e,t,r,n){n===void 0&&(n=r),e[n]=t[r]}),Mon=No&&No.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),Qht=No&&No.__exportStar||function(e,t){for(var r in e)r!=="default"&&!Object.prototype.hasOwnProperty.call(t,r)&&Jht(t,e,r)},Uon=No&&No.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(e!=null)for(var r in e)r!=="default"&&Object.prototype.hasOwnProperty.call(e,r)&&Jht(t,e,r);return Mon(t,e),t},wge=No&&No.__awaiter||function(e,t,r,n){function u(i){return i instanceof r?i:new r(function(o){o(i)})}return new(r||(r=Promise))(function(i,o){function s(l){try{c(n.next(l))}catch(f){o(f)}}function a(l){try{c(n.throw(l))}catch(f){o(f)}}function c(l){l.done?i(l.value):u(l.value).then(s,a)}c((n=n.apply(e,t||[])).next())})},tT=No&&No.__rest||function(e,t){var r={};for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&t.indexOf(n)<0&&(r[n]=e[n]);if(e!=null&&typeof Object.getOwnPropertySymbols=="function")for(var u=0,n=Object.getOwnPropertySymbols(e);u<n.length;u++)t.indexOf(n[u])<0&&Object.prototype.propertyIsEnumerable.call(e,n[u])&&(r[n[u]]=e[n[u]]);return r},Wy=No&&No.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(No,"__esModule",{value:!0});No.getInputs=void 0;var $on=Rhe();Object.defineProperty(No,"getInputs",{enumerable:!0,get:function(){return Wy($on).default}});Qht(Ihe(),No);Qht(t$(),No);var Sp=Uon(Hr()),Sge=Wy(ro()),N1=Wy(require("path")),Oge=Wy(qhe()),Tge=Mhe(),Kht=yge(),Yht=e$(),zon=Wy(Mht()),Pge=Wy(Hht()),Qr=ar(),zy=Ihe(),Ym=t$(),Won=Wy(require("assert")),ua=Hr(),Xht=_ge(),Ef=ed()("serverless-devs:parse-spec"),kge=class{constructor(t="",r={}){this.options=r,this.yaml={},this.record={},this.options.argv=this.options.argv||process.argv.slice(2),this.options.logger=this.options.logger||console,this.init(t),Ef(`yaml path: ${this.yaml.path}`),Ef(`argv: ${JSON.stringify(this.options.argv)}`)}init(t){if((0,Qr.isEmpty)(t))return this.yaml.path=(0,Kht.getDefaultYamlPath)();if(Sge.default.existsSync(t))return this.yaml.path=Sp.getAbsolutePath(t);throw new Error(`The specified template file does not exist: ${t}`)}doYamlinit(){return wge(this,void 0,void 0,function*(){yield this.doExtend(),this.doEnvironment(),this.yaml.access=(0,Qr.get)(this.yaml.content,"access");let t=this.yaml.use3x?"resources":"services",r=(0,Qr.get)(this.yaml.content,t,{});this.yaml.projectNames=(0,Qr.keys)((0,Qr.get)(this.yaml.content,t,{})),this.yaml.vars=(0,Qr.get)(this.yaml.content,"vars",{}),this.yaml.flow=(0,Qr.get)(this.yaml.content,"flow",{}),this.yaml.useFlow=!1,this.yaml.appName=(0,Qr.get)(this.yaml.content,"name");for(let n of this.yaml.projectNames)if((0,Qr.get)(r,`${n}.props.code`)){let u=Sp.getAbsolutePath((0,Qr.get)(r,`${n}.props.code`,""));(0,Tge.expand)(Oge.default.config({path:N1.default.join(u,".env")}))}(0,Tge.expand)(Oge.default.config({path:N1.default.join(N1.default.dirname(this.yaml.path),".env")}))})}doExtend(){return wge(this,void 0,void 0,function*(){if(this.yaml.content=Sp.getYamlContent(this.yaml.path),this.yaml.extend=(0,Qr.get)(this.yaml.content,"extend"),this.yaml.useExtend=(0,Kht.isExtendMode)(this.yaml.extend,N1.default.dirname(this.yaml.path)),this.yaml.useExtend){let t=Sp.getAbsolutePath(this.yaml.extend,N1.default.dirname(this.yaml.path));(0,Tge.expand)(Oge.default.config({path:N1.default.join(t,".env")}));let r=Sp.getYamlContent(t);if(this.yaml.use3x=String((0,Qr.get)(this.yaml.content,"edition",(0,Qr.get)(r,"edition")))==="3.0.0",!this.yaml.use3x)return;let{resources:n}=r,u=tT(r,["resources"]),i=this.yaml.content,{resources:o}=i,s=tT(i,["resources"]),a=Xht(!0,{},u,s),c=yield new Pge.default(Object.assign(Object.assign({},r),a),this.getParsedContentOptions(t)).start(),l=yield new Pge.default(Object.assign(Object.assign({},this.yaml.content),a),this.getParsedContentOptions(this.yaml.path)).start();this.yaml.content=Xht(!0,{},(0,Qr.get)(c,"content"),(0,Qr.get)(l,"content"));return}this.yaml.use3x=String((0,Qr.get)(this.yaml.content,"edition"))==="3.0.0"})}doEnvironment(){if(!this.yaml.use3x)return;let t=this.record.env?this.doEnvWithSpecify():this.doEnvWithNotSpecify();if((0,Qr.isEmpty)(t))return;let{project:r,environment:n}=t;Ef(`use environment: ${JSON.stringify(n)}`),(0,Qr.set)(n,"overlays.resources.region",(0,Qr.get)(n,"region")),(0,Qr.set)(n,"__project",r),this.yaml.environment=n}doEnvWithNotSpecify(){if(this.yaml.useExtend&&(0,Qr.has)(this.yaml.content,Ym.ENVIRONMENT_KEY))throw new ua.DevsError("Environment and extend is conflict",{trackerType:ua.ETrackerType.parseException});if((0,Qr.has)(this.yaml.content,Ym.ENVIRONMENT_KEY)){let t=Sp.getAbsolutePath((0,Qr.get)(this.yaml.content,Ym.ENVIRONMENT_KEY),N1.default.dirname(this.yaml.path)),r=Sp.getYamlContent(t);if((0,Qr.isEmpty)(r))throw new ua.DevsError(`Environment file [${t}] is not found`,{tips:"You can create a new environment file by running `s env init`",trackerType:ua.ETrackerType.parseException});if(!Sge.default.existsSync(Ym.ENVIRONMENT_FILE_PATH))throw new ua.DevsError("Default env is not found",{tips:"You can set a default environment by running `s env default`",trackerType:ua.ETrackerType.parseException});let{project:n,environments:u}=r,i=require(Ym.ENVIRONMENT_FILE_PATH),o=(0,Qr.get)((0,Qr.find)(i,{project:n}),"default");if(!o)throw new ua.DevsError("Default env is not found",{tips:"You can set a default environment by running `s env default`",trackerType:ua.ETrackerType.parseException});let s=(0,Qr.find)(u,a=>a.name===o);if((0,Qr.isEmpty)(s))throw new ua.DevsError(`Default env [${o}] was not found`,{trackerType:ua.ETrackerType.parseException});return{project:n,environment:s}}}doEnvWithSpecify(){if(this.yaml.useExtend)throw new ua.DevsError("Environment and extend is conflict",{trackerType:ua.ETrackerType.parseException});let t=Sp.getAbsolutePath((0,Qr.get)(this.yaml.content,Ym.ENVIRONMENT_KEY,Ym.ENVIRONMENT_FILE_NAME),N1.default.dirname(this.yaml.path)),r=Sp.getYamlContent(t);if((0,Qr.isEmpty)(r))throw new ua.DevsError(`Environment file [${t}] is not exist`,{trackerType:ua.ETrackerType.parseException});Ef(`environment content: ${JSON.stringify(r)}`);let{project:n,environments:u}=r,i=(0,Qr.find)(u,o=>o.name===this.record.env);if((0,Qr.isEmpty)(i))throw new ua.DevsError(`Env [${this.record.env}] was not found`,{trackerType:ua.ETrackerType.parseException});return{project:n,environment:i}}getParsedContentOptions(t){return{logger:this.options.logger,basePath:t,projectName:this.record.projectName,access:this.record.access,environment:this.yaml.environment}}start(){return wge(this,void 0,void 0,function*(){if(Ef("parse start"),this.parseArgv(),yield this.doYamlinit(),this.parseArgv(),!this.yaml.use3x)return this.v1();let{steps:t,content:r,originSteps:n}=yield new Pge.default(this.yaml.content,this.getParsedContentOptions(this.yaml.path)).start();this.yaml.content=r,this.yaml.vars=(0,Qr.get)(this.yaml.content,"vars",{});let u=(0,Qr.get)(this.yaml.content,"actions",{});this.yaml.actions=this.parseActions(u);let i=Object.assign({steps:this.record.projectName?t:this.doFlow(t,n),yaml:this.yaml},this.record);return Ef(`parse result: ${JSON.stringify(i)}`),Ef("parse end"),i})}v1(){let t=[],r=(0,Qr.get)(this.yaml.content,"services",{});for(let n in r){let u=r[n];t.push(Object.assign(Object.assign({},u),{projectName:n}))}return Object.assign({steps:this.record.projectName?(0,Qr.filter)(t,n=>n.projectName===this.record.projectName):t,yaml:this.yaml},this.record)}parseArgv(){let t=Sp.parseArgv(this.options.argv);Ef(`parse argv: ${JSON.stringify(t)}`);let{_:r}=t;if(this.record.access=(0,Qr.get)(t,"access"),this.record.version=(0,Qr.get)(t,"version"),this.record.help=(0,Qr.get)(t,"help"),this.record.output=(0,Qr.get)(t,"output"),this.record.skipActions=(0,Qr.get)(t,"skip-actions"),this.record.debug=(0,Qr.get)(t,"debug"),this.record.env=(0,Qr.get)(t,"env"),(0,Qr.includes)(this.yaml.projectNames,r[0])){this.record.projectName=r[0],this.record.command=r[1];return}this.record.command=r[0]}doFlow(t,r){let n=[],u=(0,Qr.find)(this.yaml.flow,(f,p)=>this.matchFlow(p)),i=new zon.default(r).start(),{steps:o,dependencies:s,useOrder:a}=i.sort(t);if(!u)return o;Ef(`find flow: ${JSON.stringify(u)}`);let c={},l=(f=[],p)=>{(0,Won.default)((0,Qr.isArray)(f),`flow ${this.record.command} data format is invalid`);for(let h of f)for(let d of t)h===d.projectName&&(n.push(Object.assign(Object.assign({},d),{flowId:p})),c[d.projectName]=p)};if((0,Qr.each)(u,l),Ef(`flow steps: ${JSON.stringify(n)}`),this.yaml.useFlow=!0,Ef(`flow projectOrder: ${JSON.stringify(c)}`),a){Ef(`project dependencies: ${JSON.stringify(s)}`);for(let f in s){let p=s[f];for(let h in p)if(c[h]>=c[f])throw new Error(`flow is invalid, ${h} must be executed before ${f}`)}}return n}matchFlow(t){return Ym.REGX.test(t)?Yht(t,{command:this.record.command}):t===this.record.command}parseActions(t={},r=zy.IActionLevel.GLOBAL){let n=[];for(let u in t){let i=t[u];if(!(0,Qr.isArray)(i))throw new ua.DevsError(`${r} action ${u} is invalid, it must be array`,{trackerType:ua.ETrackerType.parseException});let o=this.matchAction(u);Ef(`action: ${u}, useAction: ${JSON.stringify(o)}`),o.validate&&n.push(...(0,Qr.map)(i,s=>{if(s[zy.IActionType.RUN]){let{run:a}=s,c=tT(s,["run"]);return Object.assign(Object.assign({},c),{value:a,path:Sp.getAbsolutePath((0,Qr.get)(s,"path","./"),N1.default.dirname(this.yaml.path)),actionType:zy.IActionType.RUN,hookType:o.type,level:r,projectName:this.record.projectName})}if(s[zy.IActionType.PLUGIN]){let{plugin:a}=s,c=tT(s,["plugin"]),l=Sp.getAbsolutePath(a,N1.default.dirname(this.yaml.path));return Object.assign(Object.assign({},c),{value:Sge.default.existsSync(l)?l:a,actionType:zy.IActionType.PLUGIN,hookType:o.type,level:r,projectName:this.record.projectName})}if(s[zy.IActionType.COMPONENT]){let{component:a}=s,c=tT(s,["component"]);return Object.assign(Object.assign({},c),{value:a,actionType:zy.IActionType.COMPONENT,hookType:o.type,level:r,projectName:this.record.projectName})}}))}return Ef(`parse actions: ${JSON.stringify(n)}`),n}matchAction(t){if(Ym.REGX.test(t)){let i=Yht(t,{command:this.record.command}),[o,s]=(0,Qr.split)(i,"-");return{validate:s==="true",type:o}}let[n,u]=(0,Qr.split)(t,"-");return{validate:u===this.record.command,type:n}}};No.default=kge});var rT=L((uxu,rdt)=>{var Gon=require("path").relative;rdt.exports=Xon;var Von=process.cwd();function edt(e,t){for(var r=e.split(/[ ,]+/),n=String(t).toLowerCase(),u=0;u<r.length;u++){var i=r[u];if(i&&(i==="*"||i.toLowerCase()===n))return!0}return!1}function Hon(e,t,r){var n=Object.getOwnPropertyDescriptor(e,t),u=n.value;return n.get=function(){return u},n.writable&&(n.set=function(o){return u=o}),delete n.value,delete n.writable,Object.defineProperty(e,t,n),n}function Kon(e){for(var t="",r=0;r<e;r++)t+=", arg"+r;return t.substr(2)}function Yon(e){var t=this.name+": "+this.namespace;this.message&&(t+=" deprecated "+this.message);for(var r=0;r<e.length;r++)t+=`
210
210
  at `+e[r].toString();return t}function Xon(e){if(!e)throw new TypeError("argument namespace is required");var t=mY(),r=qb(t[1]),n=r[0];function u(i){dY.call(u,i)}return u._file=n,u._ignored=Qon(e),u._namespace=e,u._traced=Zon(e),u._warned=Object.create(null),u.function=nsn,u.property=usn,u}function Jon(e,t){var r=typeof e.listenerCount!="function"?e.listeners(t).length:e.listenerCount(t);return r>0}function Qon(e){if(process.noDeprecation)return!0;var t=process.env.NO_DEPRECATION||"";return edt(t,e)}function Zon(e){if(process.traceDeprecation)return!0;var t=process.env.TRACE_DEPRECATION||"";return edt(t,e)}function dY(e,t){var r=Jon(process,"deprecation");if(!(!r&&this._ignored)){var n,u,i,o,s=0,a=!1,c=mY(),l=this._file;for(t?(o=t,i=qb(c[1]),i.name=o.name,l=i[0]):(s=2,o=qb(c[s]),i=o);s<c.length;s++)if(n=qb(c[s]),u=n[0],u===l)a=!0;else if(u===this._file)l=this._file;else if(a)break;var f=n?o.join(":")+"__"+n.join(":"):void 0;if(!(f!==void 0&&f in this._warned)){this._warned[f]=!0;var p=e;if(p||(p=i===o||!i.name?Zht(o):Zht(i)),r){var h=tdt(this._namespace,p,c.slice(s));process.emit("deprecation",h);return}var d=process.stderr.isTTY?tsn:esn,m=d.call(this,p,n,c.slice(s));process.stderr.write(m+`
211
211
  `,"utf8")}}}function qb(e){var t=e.getFileName()||"<anonymous>",r=e.getLineNumber(),n=e.getColumnNumber();e.isEval()&&(t=e.getEvalOrigin()+", "+t);var u=[t,r,n];return u.callSite=e,u.name=e.getFunctionName(),u}function Zht(e){var t=e.callSite,r=e.name;r||(r="<anonymous@"+Rge(e)+">");var n=t.getThis(),u=n&&t.getTypeName();return u==="Object"&&(u=void 0),u==="Function"&&(u=n.name||u),u&&t.getMethodName()?u+"."+r:r}function esn(e,t,r){var n=new Date().toUTCString(),u=n+" "+this._namespace+" deprecated "+e;if(this._traced){for(var i=0;i<r.length;i++)u+=`
212
212
  at `+r[i].toString();return u}return t&&(u+=" at "+Rge(t)),u}function tsn(e,t,r){var n="\x1B[36;1m"+this._namespace+"\x1B[22;39m \x1B[33;1mdeprecated\x1B[22;39m \x1B[0m"+e+"\x1B[39m";if(this._traced){for(var u=0;u<r.length;u++)n+=`
@@ -336,7 +336,7 @@ ${" ".repeat(u)}`))}this._progressContent=`${t.join(`
336
336
  ${vxt("ERROR:")}`),Ft.write(`
337
337
  ${t}
338
338
  `),r&&Ft.write(`${Dt.gray(r)}
339
- `)}},qP=W9e});var MP=L((HOu,O3n)=>{O3n.exports={name:"@serverless-devs/s3",version:"0.1.4-beta.1",description:"Serverless devs tool, serverless developer tool, supports Alibaba cloud, AWS, azure, baidu cloud, Huawei cloud, Google cloud and Tencent cloud.",homepage:"https://www.serverless-devs.com",keywords:["serverless","alibaba","tencent","azure","baidu","huawei","google","function","faas","serverless-devs"],publishConfig:{access:"public",registry:"https://registry.npmjs.org"},license:"Apache 2.0",repository:{type:"git",url:"https://github.com/Serverless-Devs/Serverless-Devs"},bugs:{url:"https://github.com/Serverless-Devs/Serverless-Devs/issues"},scripts:{start:"npm run watch",test:"jest --testTimeout 10000","test:watch":"jest --testTimeout 10000 --watchAll",format:"prettier --write src/ __tests__/**/*.test.ts",watch:"npm run build -- --watch",prebuild:"rm -rf node_modules && npm install --production false",build:"node ./scripts/build.js",pkg:"pkg . --out-path releases",prepublishOnly:"npm run build",beta:"npm publish --tag=beta",pub:"npm publish"},pkg:{scripts:["./lib/daemon/**/*.js"]},main:"./lib/index.js",bin:{s:"bin/s"},engines:{node:">=14.14.0"},devDependencies:{"@serverless-devs/core":"^0.1.66","@serverless-devs/credential":"^0.0.3","@serverless-devs/engine":"^0.0.23","@serverless-devs/load-application":"^0.0.9","@serverless-devs/load-component":"^0.0.6","@serverless-devs/logger":"^0.0.3","@serverless-devs/parse-spec":"^0.0.20","@serverless-devs/registry":"^0.0.4","@serverless-devs/utils":"^0.0.14","@types/fs-extra":"^11.0.4","@types/inquirer":"^9.0.7","@types/jest":"^29.5.8","@types/js-yaml":"^4.0.9","@types/lodash":"^4.14.201","@types/node":"^20.9.1","@types/semver":"^7.5.5",axios:"^1.6.2",boxen:"^7.1.1",chalk:"^5.3.0",commander:"^11.1.0",dotenv:"^16.3.1","dotenv-expand":"^10.0.0",esbuild:"^0.19.5","fs-extra":"^11.1.1","global-agent":"^3.0.0",inquirer:"^9.2.12","inquirer-autocomplete-prompt":"^3.0.1",jest:"^29.7.0","js-yaml":"^4.1.0","latest-version":"^7.0.0",leven:"^4.0.0",lodash:"^4.17.21",pkg:"^5.8.1",prettier:"^3.1.0",prettyjson:"^1.2.5",rimraf:"^5.0.5",semver:"^7.5.4","semver-diff":"^4.0.0","table-layout":"^3.0.2","ts-jest":"^29.1.1","ts-node":"^10.9.1",typescript:"^5.2.2",ajv:"^8.12.0"},"lint-staged":{"**/*.{js,jsx,ts}":"f2elint exec eslint"}}});var _0,ZJ,UP,Axt,DE,bxt,T3n,Cxt,P3n,xxt,ld,yg=wt(()=>{_0=ot(Hr());eu();Rr();ZJ=ot(require("path")),UP=ot(ro());Dn();Axt=ot(Hr()),DE=ot(ar());vg();Ext();bxt=MP(),T3n=async(e,t={})=>{Ft.unsilent();let{silent:r}=(0,Axt.parseArgv)(process.argv.slice(2)),n=ZJ.default.join((0,_0.getRootHome)(),"logs",process.env.serverless_devs_traceid,"error.json");UP.default.ensureFileSync(n),UP.default.writeJSONSync(n,[],{spaces:2});let u=1;if((0,DE.isArray)(e))for(let i of e){Cxt(i,t);let o=(0,DE.get)(i,"exitCode");o&&(u=o)}else{Cxt(e,t);let i=(0,DE.get)(e,"exitCode");i&&(u=i)}Ft.write(" "),Ft.write(Fxt([{key:"Env:",value:`${bxt.name}: ${bxt.version}, ${process.platform}-${process.arch} node-${process.version}`},{key:"Logs:",value:Dt.underline(ZJ.default.join((0,_0.getRootHome)(),"logs",process.env.serverless_devs_traceid))},{key:"Get Help:",value:"DingTalk: 33947367"},{key:"Feedback:",value:Dt.cyan.underline("https://github.com/Serverless-Devs/Serverless-Devs/issues")}])),r&&Ft.silent(),process.exitCode=u},Cxt=(e,t={})=>{Uc("report.js",{argv:process.argv.slice(2),userAgent:(0,_0.getUserAgent)(),...t,type:(0,DE.get)(e,"trackerType"),message:e.message}),P3n(e),Ft.write(" ");let r=e;if(r.CODE===_0.DevsError.CODE){let i=r.prefix?[`${Dt.red("\u2716")} ${r.prefix}`,"===================="]:[];i.push(Dt.red("Error Message:"),Dt.red((0,_0.isDebugMode)()?r.stack:r.message)),r.tips&&i.push(`
339
+ `)}},qP=W9e});var MP=L((HOu,O3n)=>{O3n.exports={name:"@serverless-devs/s3",version:"0.1.4",description:"Serverless devs tool, serverless developer tool, supports Alibaba cloud, AWS, azure, baidu cloud, Huawei cloud, Google cloud and Tencent cloud.",homepage:"https://www.serverless-devs.com",keywords:["serverless","alibaba","tencent","azure","baidu","huawei","google","function","faas","serverless-devs"],publishConfig:{access:"public",registry:"https://registry.npmjs.org"},license:"Apache 2.0",repository:{type:"git",url:"https://github.com/Serverless-Devs/Serverless-Devs"},bugs:{url:"https://github.com/Serverless-Devs/Serverless-Devs/issues"},scripts:{start:"npm run watch",test:"jest --testTimeout 10000","test:watch":"jest --testTimeout 10000 --watchAll",format:"prettier --write src/ __tests__/**/*.test.ts",watch:"npm run build -- --watch",prebuild:"rm -rf node_modules && npm install --production false",build:"node ./scripts/build.js",pkg:"pkg . --out-path releases",prepublishOnly:"npm run build",beta:"npm publish --tag=beta",pub:"npm publish"},pkg:{scripts:["./lib/daemon/**/*.js"]},main:"./lib/index.js",bin:{s:"bin/s"},engines:{node:">=14.14.0"},devDependencies:{"@serverless-devs/core":"^0.1.66","@serverless-devs/credential":"^0.0.3","@serverless-devs/engine":"^0.0.24","@serverless-devs/load-application":"^0.0.10","@serverless-devs/load-component":"^0.0.6","@serverless-devs/logger":"^0.0.3","@serverless-devs/parse-spec":"^0.0.21","@serverless-devs/registry":"^0.0.4","@serverless-devs/utils":"^0.0.14","@types/fs-extra":"^11.0.4","@types/inquirer":"^9.0.7","@types/jest":"^29.5.8","@types/js-yaml":"^4.0.9","@types/lodash":"^4.14.201","@types/node":"^20.9.1","@types/semver":"^7.5.5",axios:"^1.6.2",boxen:"^7.1.1",chalk:"^5.3.0",commander:"^11.1.0",dotenv:"^16.3.1","dotenv-expand":"^10.0.0",esbuild:"^0.19.5","fs-extra":"^11.1.1","global-agent":"^3.0.0",inquirer:"^9.2.12","inquirer-autocomplete-prompt":"^3.0.1",jest:"^29.7.0","js-yaml":"^4.1.0","latest-version":"^7.0.0",leven:"^4.0.0",lodash:"^4.17.21",pkg:"^5.8.1",prettier:"^3.1.0",prettyjson:"^1.2.5",rimraf:"^5.0.5",semver:"^7.5.4","semver-diff":"^4.0.0","table-layout":"^3.0.2","ts-jest":"^29.1.1","ts-node":"^10.9.1",typescript:"^5.2.2",ajv:"^8.12.0"},"lint-staged":{"**/*.{js,jsx,ts}":"f2elint exec eslint"}}});var _0,ZJ,UP,Axt,DE,bxt,T3n,Cxt,P3n,xxt,ld,yg=wt(()=>{_0=ot(Hr());eu();Rr();ZJ=ot(require("path")),UP=ot(ro());Dn();Axt=ot(Hr()),DE=ot(ar());vg();Ext();bxt=MP(),T3n=async(e,t={})=>{Ft.unsilent();let{silent:r}=(0,Axt.parseArgv)(process.argv.slice(2)),n=ZJ.default.join((0,_0.getRootHome)(),"logs",process.env.serverless_devs_traceid,"error.json");UP.default.ensureFileSync(n),UP.default.writeJSONSync(n,[],{spaces:2});let u=1;if((0,DE.isArray)(e))for(let i of e){Cxt(i,t);let o=(0,DE.get)(i,"exitCode");o&&(u=o)}else{Cxt(e,t);let i=(0,DE.get)(e,"exitCode");i&&(u=i)}Ft.write(" "),Ft.write(Fxt([{key:"Env:",value:`${bxt.name}: ${bxt.version}, ${process.platform}-${process.arch} node-${process.version}`},{key:"Logs:",value:Dt.underline(ZJ.default.join((0,_0.getRootHome)(),"logs",process.env.serverless_devs_traceid))},{key:"Get Help:",value:"DingTalk: 33947367"},{key:"Feedback:",value:Dt.cyan.underline("https://github.com/Serverless-Devs/Serverless-Devs/issues")}])),r&&Ft.silent(),process.exitCode=u},Cxt=(e,t={})=>{Uc("report.js",{argv:process.argv.slice(2),userAgent:(0,_0.getUserAgent)(),...t,type:(0,DE.get)(e,"trackerType"),message:e.message}),P3n(e),Ft.write(" ");let r=e;if(r.CODE===_0.DevsError.CODE){let i=r.prefix?[`${Dt.red("\u2716")} ${r.prefix}`,"===================="]:[];i.push(Dt.red("Error Message:"),Dt.red((0,_0.isDebugMode)()?r.stack:r.message)),r.tips&&i.push(`
340
340
  \u{1F37C} Tips`,"====================",Dt.yellow(`${r.tips}`)),Ft.write(i.join(`
341
341
  `)),xxt(r.stack);return}let n=e,u=[Dt.red("Error Message:"),Dt.red((0,_0.isDebugMode)()?n.stack:n.message)];Ft.write(u.join(`
342
342
  `)),xxt(n.stack)},P3n=e=>{let t=u=>{let i=(0,DE.get)(u,"data");if(i)return i;let o=u;return o.CODE===_0.DevsError.CODE?{prefix:o.prefix,message:o.message,exitCode:o.exitCode,tips:o.tips}:{message:o.message}},r=ZJ.default.join((0,_0.getRootHome)(),"logs",process.env.serverless_devs_traceid,"error.json"),n=UP.default.readJSONSync(r);n.push(t(e)),UP.default.writeJSONSync(r,n,{spaces:2})},xxt=e=>{(0,_0.isDebugMode)()||Ft.debug(e)},ld=T3n});function R3n(){let{version:e}=G9e.default.minVersion(k3n.engines.node);G9e.default.gte(process.versions.node,e)||(new qP(`Node.js version must be greater than or equal to ${e}`,`Your current Node.js version is ${process.versions.node}, please upgrade your Node.js version at ${Dt.underline("https://nodejs.org/en")}.`),process.exit(1))}var G9e,k3n,V9e,_xt=wt(()=>{yg();Rr();G9e=ot(vE()),k3n=MP();V9e=R3n});var Bxt=L(eQ=>{"use strict";Object.defineProperty(eQ,"__esModule",{value:!0});eQ.boolean=void 0;var I3n=function(e){switch(Object.prototype.toString.call(e)){case"[object String]":return["true","t","yes","y","on","1"].includes(e.trim().toLowerCase());case"[object Number]":return e.valueOf()===1;case"[object Boolean]":return e.valueOf();default:return!1}};eQ.boolean=I3n});var wxt=L(tQ=>{"use strict";Object.defineProperty(tQ,"__esModule",{value:!0});tQ.isBooleanable=void 0;var j3n=function(e){switch(Object.prototype.toString.call(e)){case"[object String]":return["true","t","yes","y","on","1","false","f","no","n","off","0"].includes(e.trim().toLowerCase());case"[object Number]":return[0,1].includes(e.valueOf());case"[object Boolean]":return!0;default:return!1}};tQ.isBooleanable=j3n});var rQ=L(KC=>{"use strict";Object.defineProperty(KC,"__esModule",{value:!0});KC.isBooleanable=KC.boolean=void 0;var L3n=Bxt();Object.defineProperty(KC,"boolean",{enumerable:!0,get:function(){return L3n.boolean}});var N3n=wxt();Object.defineProperty(KC,"isBooleanable",{enumerable:!0,get:function(){return N3n.isBooleanable}})});var nQ=L((oTu,Sxt)=>{Sxt.exports=Object.prototype.toString.call(typeof process<"u"?process:0)==="[object process]"});var H9e=L((sTu,Txt)=>{"use strict";var Oxt=Object.prototype.toString;Txt.exports=function(t){var r=Oxt.call(t),n=r==="[object Arguments]";return n||(n=r!=="[object Array]"&&t!==null&&typeof t=="object"&&typeof t.length=="number"&&t.length>=0&&Oxt.call(t.callee)==="[object Function]"),n}});var Mxt=L((aTu,qxt)=>{"use strict";var Nxt;Object.keys||($P=Object.prototype.hasOwnProperty,K9e=Object.prototype.toString,Pxt=H9e(),Y9e=Object.prototype.propertyIsEnumerable,kxt=!Y9e.call({toString:null},"toString"),Rxt=Y9e.call(function(){},"prototype"),zP=["toString","toLocaleString","valueOf","hasOwnProperty","isPrototypeOf","propertyIsEnumerable","constructor"],uQ=function(e){var t=e.constructor;return t&&t.prototype===e},Ixt={$applicationCache:!0,$console:!0,$external:!0,$frame:!0,$frameElement:!0,$frames:!0,$innerHeight:!0,$innerWidth:!0,$onmozfullscreenchange:!0,$onmozfullscreenerror:!0,$outerHeight:!0,$outerWidth:!0,$pageXOffset:!0,$pageYOffset:!0,$parent:!0,$scrollLeft:!0,$scrollTop:!0,$scrollX:!0,$scrollY:!0,$self:!0,$webkitIndexedDB:!0,$webkitStorageInfo:!0,$window:!0},jxt=function(){if(typeof window>"u")return!1;for(var e in window)try{if(!Ixt["$"+e]&&$P.call(window,e)&&window[e]!==null&&typeof window[e]=="object")try{uQ(window[e])}catch{return!0}}catch{return!0}return!1}(),Lxt=function(e){if(typeof window>"u"||!jxt)return uQ(e);try{return uQ(e)}catch{return!1}},Nxt=function(t){var r=t!==null&&typeof t=="object",n=K9e.call(t)==="[object Function]",u=Pxt(t),i=r&&K9e.call(t)==="[object String]",o=[];if(!r&&!n&&!u)throw new TypeError("Object.keys called on a non-object");var s=Rxt&&n;if(i&&t.length>0&&!$P.call(t,0))for(var a=0;a<t.length;++a)o.push(String(a));if(u&&t.length>0)for(var c=0;c<t.length;++c)o.push(String(c));else for(var l in t)!(s&&l==="prototype")&&$P.call(t,l)&&o.push(String(l));if(kxt)for(var f=Lxt(t),p=0;p<zP.length;++p)!(f&&zP[p]==="constructor")&&$P.call(t,zP[p])&&o.push(zP[p]);return o});var $P,K9e,Pxt,Y9e,kxt,Rxt,zP,uQ,Ixt,jxt,Lxt;qxt.exports=Nxt});var Wxt=L((cTu,zxt)=>{"use strict";var q3n=Array.prototype.slice,M3n=H9e(),Uxt=Object.keys,iQ=Uxt?function(t){return Uxt(t)}:Mxt(),$xt=Object.keys;iQ.shim=function(){if(Object.keys){var t=function(){var r=Object.keys(arguments);return r&&r.length===arguments.length}(1,2);t||(Object.keys=function(n){return M3n(n)?$xt(q3n.call(n)):$xt(n)})}else Object.keys=iQ;return Object.keys||iQ};zxt.exports=iQ});var Vxt=L((lTu,Gxt)=>{"use strict";Gxt.exports=function(){if(typeof Symbol!="function"||typeof Object.getOwnPropertySymbols!="function")return!1;if(typeof Symbol.iterator=="symbol")return!0;var t={},r=Symbol("test"),n=Object(r);if(typeof r=="string"||Object.prototype.toString.call(r)!=="[object Symbol]"||Object.prototype.toString.call(n)!=="[object Symbol]")return!1;var u=42;t[r]=u;for(r in t)return!1;if(typeof Object.keys=="function"&&Object.keys(t).length!==0||typeof Object.getOwnPropertyNames=="function"&&Object.getOwnPropertyNames(t).length!==0)return!1;var i=Object.getOwnPropertySymbols(t);if(i.length!==1||i[0]!==r||!Object.prototype.propertyIsEnumerable.call(t,r))return!1;if(typeof Object.getOwnPropertyDescriptor=="function"){var o=Object.getOwnPropertyDescriptor(t,r);if(o.value!==u||o.enumerable!==!0)return!1}return!0}});var Yxt=L((fTu,Kxt)=>{"use strict";var Hxt=typeof Symbol<"u"&&Symbol,U3n=Vxt();Kxt.exports=function(){return typeof Hxt!="function"||typeof Symbol!="function"||typeof Hxt("foo")!="symbol"||typeof Symbol("bar")!="symbol"?!1:U3n()}});var Qxt=L((pTu,Jxt)=>{"use strict";var Xxt={foo:{}},$3n=Object;Jxt.exports=function(){return{__proto__:Xxt}.foo===Xxt.foo&&!({__proto__:null}instanceof $3n)}});var tAt=L((hTu,eAt)=>{"use strict";var z3n="Function.prototype.bind called on incompatible ",W3n=Object.prototype.toString,G3n=Math.max,V3n="[object Function]",Zxt=function(t,r){for(var n=[],u=0;u<t.length;u+=1)n[u]=t[u];for(var i=0;i<r.length;i+=1)n[i+t.length]=r[i];return n},H3n=function(t,r){for(var n=[],u=r||0,i=0;u<t.length;u+=1,i+=1)n[i]=t[u];return n},K3n=function(e,t){for(var r="",n=0;n<e.length;n+=1)r+=e[n],n+1<e.length&&(r+=t);return r};eAt.exports=function(t){var r=this;if(typeof r!="function"||W3n.apply(r)!==V3n)throw new TypeError(z3n+r);for(var n=H3n(arguments,1),u,i=function(){if(this instanceof u){var l=r.apply(this,Zxt(n,arguments));return Object(l)===l?l:this}return r.apply(t,Zxt(n,arguments))},o=G3n(0,r.length-n.length),s=[],a=0;a<o;a++)s[a]="$"+a;if(u=Function("binder","return function ("+K3n(s,",")+"){ return binder.apply(this,arguments); }")(i),r.prototype){var c=function(){};c.prototype=r.prototype,u.prototype=new c,c.prototype=null}return u}});var oQ=L((dTu,rAt)=>{"use strict";var Y3n=tAt();rAt.exports=Function.prototype.bind||Y3n});var uAt=L((mTu,nAt)=>{"use strict";var X3n=Function.prototype.call,J3n=Object.prototype.hasOwnProperty,Q3n=oQ();nAt.exports=Q3n.call(X3n,J3n)});var ZC=L((gTu,cAt)=>{"use strict";var tu,QC=SyntaxError,aAt=Function,JC=TypeError,X9e=function(e){try{return aAt('"use strict"; return ('+e+").constructor;")()}catch{}},yE=Object.getOwnPropertyDescriptor;if(yE)try{yE({},"")}catch{yE=null}var J9e=function(){throw new JC},Z3n=yE?function(){try{return arguments.callee,J9e}catch{try{return yE(arguments,"callee").get}catch{return J9e}}}():J9e,YC=Yxt()(),e7n=Qxt()(),oa=Object.getPrototypeOf||(e7n?function(e){return e.__proto__}:null),XC={},t7n=typeof Uint8Array>"u"||!oa?tu:oa(Uint8Array),EE={"%AggregateError%":typeof AggregateError>"u"?tu:AggregateError,"%Array%":Array,"%ArrayBuffer%":typeof ArrayBuffer>"u"?tu:ArrayBuffer,"%ArrayIteratorPrototype%":YC&&oa?oa([][Symbol.iterator]()):tu,"%AsyncFromSyncIteratorPrototype%":tu,"%AsyncFunction%":XC,"%AsyncGenerator%":XC,"%AsyncGeneratorFunction%":XC,"%AsyncIteratorPrototype%":XC,"%Atomics%":typeof Atomics>"u"?tu:Atomics,"%BigInt%":typeof BigInt>"u"?tu:BigInt,"%BigInt64Array%":typeof BigInt64Array>"u"?tu:BigInt64Array,"%BigUint64Array%":typeof BigUint64Array>"u"?tu:BigUint64Array,"%Boolean%":Boolean,"%DataView%":typeof DataView>"u"?tu:DataView,"%Date%":Date,"%decodeURI%":decodeURI,"%decodeURIComponent%":decodeURIComponent,"%encodeURI%":encodeURI,"%encodeURIComponent%":encodeURIComponent,"%Error%":Error,"%eval%":eval,"%EvalError%":EvalError,"%Float32Array%":typeof Float32Array>"u"?tu:Float32Array,"%Float64Array%":typeof Float64Array>"u"?tu:Float64Array,"%FinalizationRegistry%":typeof FinalizationRegistry>"u"?tu:FinalizationRegistry,"%Function%":aAt,"%GeneratorFunction%":XC,"%Int8Array%":typeof Int8Array>"u"?tu:Int8Array,"%Int16Array%":typeof Int16Array>"u"?tu:Int16Array,"%Int32Array%":typeof Int32Array>"u"?tu:Int32Array,"%isFinite%":isFinite,"%isNaN%":isNaN,"%IteratorPrototype%":YC&&oa?oa(oa([][Symbol.iterator]())):tu,"%JSON%":typeof JSON=="object"?JSON:tu,"%Map%":typeof Map>"u"?tu:Map,"%MapIteratorPrototype%":typeof Map>"u"||!YC||!oa?tu:oa(new Map()[Symbol.iterator]()),"%Math%":Math,"%Number%":Number,"%Object%":Object,"%parseFloat%":parseFloat,"%parseInt%":parseInt,"%Promise%":typeof Promise>"u"?tu:Promise,"%Proxy%":typeof Proxy>"u"?tu:Proxy,"%RangeError%":RangeError,"%ReferenceError%":ReferenceError,"%Reflect%":typeof Reflect>"u"?tu:Reflect,"%RegExp%":RegExp,"%Set%":typeof Set>"u"?tu:Set,"%SetIteratorPrototype%":typeof Set>"u"||!YC||!oa?tu:oa(new Set()[Symbol.iterator]()),"%SharedArrayBuffer%":typeof SharedArrayBuffer>"u"?tu:SharedArrayBuffer,"%String%":String,"%StringIteratorPrototype%":YC&&oa?oa(""[Symbol.iterator]()):tu,"%Symbol%":YC?Symbol:tu,"%SyntaxError%":QC,"%ThrowTypeError%":Z3n,"%TypedArray%":t7n,"%TypeError%":JC,"%Uint8Array%":typeof Uint8Array>"u"?tu:Uint8Array,"%Uint8ClampedArray%":typeof Uint8ClampedArray>"u"?tu:Uint8ClampedArray,"%Uint16Array%":typeof Uint16Array>"u"?tu:Uint16Array,"%Uint32Array%":typeof Uint32Array>"u"?tu:Uint32Array,"%URIError%":URIError,"%WeakMap%":typeof WeakMap>"u"?tu:WeakMap,"%WeakRef%":typeof WeakRef>"u"?tu:WeakRef,"%WeakSet%":typeof WeakSet>"u"?tu:WeakSet};if(oa)try{null.error}catch(e){iAt=oa(oa(e)),EE["%Error.prototype%"]=iAt}var iAt,r7n=function e(t){var r;if(t==="%AsyncFunction%")r=X9e("async function () {}");else if(t==="%GeneratorFunction%")r=X9e("function* () {}");else if(t==="%AsyncGeneratorFunction%")r=X9e("async function* () {}");else if(t==="%AsyncGenerator%"){var n=e("%AsyncGeneratorFunction%");n&&(r=n.prototype)}else if(t==="%AsyncIteratorPrototype%"){var u=e("%AsyncGenerator%");u&&oa&&(r=oa(u.prototype))}return EE[t]=r,r},oAt={"%ArrayBufferPrototype%":["ArrayBuffer","prototype"],"%ArrayPrototype%":["Array","prototype"],"%ArrayProto_entries%":["Array","prototype","entries"],"%ArrayProto_forEach%":["Array","prototype","forEach"],"%ArrayProto_keys%":["Array","prototype","keys"],"%ArrayProto_values%":["Array","prototype","values"],"%AsyncFunctionPrototype%":["AsyncFunction","prototype"],"%AsyncGenerator%":["AsyncGeneratorFunction","prototype"],"%AsyncGeneratorPrototype%":["AsyncGeneratorFunction","prototype","prototype"],"%BooleanPrototype%":["Boolean","prototype"],"%DataViewPrototype%":["DataView","prototype"],"%DatePrototype%":["Date","prototype"],"%ErrorPrototype%":["Error","prototype"],"%EvalErrorPrototype%":["EvalError","prototype"],"%Float32ArrayPrototype%":["Float32Array","prototype"],"%Float64ArrayPrototype%":["Float64Array","prototype"],"%FunctionPrototype%":["Function","prototype"],"%Generator%":["GeneratorFunction","prototype"],"%GeneratorPrototype%":["GeneratorFunction","prototype","prototype"],"%Int8ArrayPrototype%":["Int8Array","prototype"],"%Int16ArrayPrototype%":["Int16Array","prototype"],"%Int32ArrayPrototype%":["Int32Array","prototype"],"%JSONParse%":["JSON","parse"],"%JSONStringify%":["JSON","stringify"],"%MapPrototype%":["Map","prototype"],"%NumberPrototype%":["Number","prototype"],"%ObjectPrototype%":["Object","prototype"],"%ObjProto_toString%":["Object","prototype","toString"],"%ObjProto_valueOf%":["Object","prototype","valueOf"],"%PromisePrototype%":["Promise","prototype"],"%PromiseProto_then%":["Promise","prototype","then"],"%Promise_all%":["Promise","all"],"%Promise_reject%":["Promise","reject"],"%Promise_resolve%":["Promise","resolve"],"%RangeErrorPrototype%":["RangeError","prototype"],"%ReferenceErrorPrototype%":["ReferenceError","prototype"],"%RegExpPrototype%":["RegExp","prototype"],"%SetPrototype%":["Set","prototype"],"%SharedArrayBufferPrototype%":["SharedArrayBuffer","prototype"],"%StringPrototype%":["String","prototype"],"%SymbolPrototype%":["Symbol","prototype"],"%SyntaxErrorPrototype%":["SyntaxError","prototype"],"%TypedArrayPrototype%":["TypedArray","prototype"],"%TypeErrorPrototype%":["TypeError","prototype"],"%Uint8ArrayPrototype%":["Uint8Array","prototype"],"%Uint8ClampedArrayPrototype%":["Uint8ClampedArray","prototype"],"%Uint16ArrayPrototype%":["Uint16Array","prototype"],"%Uint32ArrayPrototype%":["Uint32Array","prototype"],"%URIErrorPrototype%":["URIError","prototype"],"%WeakMapPrototype%":["WeakMap","prototype"],"%WeakSetPrototype%":["WeakSet","prototype"]},WP=oQ(),sQ=uAt(),n7n=WP.call(Function.call,Array.prototype.concat),u7n=WP.call(Function.apply,Array.prototype.splice),sAt=WP.call(Function.call,String.prototype.replace),aQ=WP.call(Function.call,String.prototype.slice),i7n=WP.call(Function.call,RegExp.prototype.exec),o7n=/[^%.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|%$))/g,s7n=/\\(\\)?/g,a7n=function(t){var r=aQ(t,0,1),n=aQ(t,-1);if(r==="%"&&n!=="%")throw new QC("invalid intrinsic syntax, expected closing `%`");if(n==="%"&&r!=="%")throw new QC("invalid intrinsic syntax, expected opening `%`");var u=[];return sAt(t,o7n,function(i,o,s,a){u[u.length]=s?sAt(a,s7n,"$1"):o||i}),u},c7n=function(t,r){var n=t,u;if(sQ(oAt,n)&&(u=oAt[n],n="%"+u[0]+"%"),sQ(EE,n)){var i=EE[n];if(i===XC&&(i=r7n(n)),typeof i>"u"&&!r)throw new JC("intrinsic "+t+" exists, but is not available. Please file an issue!");return{alias:u,name:n,value:i}}throw new QC("intrinsic "+t+" does not exist!")};cAt.exports=function(t,r){if(typeof t!="string"||t.length===0)throw new JC("intrinsic name must be a non-empty string");if(arguments.length>1&&typeof r!="boolean")throw new JC('"allowMissing" argument must be a boolean');if(i7n(/^%?[^%]*%?$/,t)===null)throw new QC("`%` may not be present anywhere but at the beginning and end of the intrinsic name");var n=a7n(t),u=n.length>0?n[0]:"",i=c7n("%"+u+"%",r),o=i.name,s=i.value,a=!1,c=i.alias;c&&(u=c[0],u7n(n,n7n([0,1],c)));for(var l=1,f=!0;l<n.length;l+=1){var p=n[l],h=aQ(p,0,1),d=aQ(p,-1);if((h==='"'||h==="'"||h==="`"||d==='"'||d==="'"||d==="`")&&h!==d)throw new QC("property names with quotes must have matching quotes");if((p==="constructor"||!f)&&(a=!0),u+="."+p,o="%"+u+"%",sQ(EE,o))s=EE[o];else if(s!=null){if(!(p in s)){if(!r)throw new JC("base intrinsic for "+t+" exists, but the property is not available.");return}if(yE&&l+1>=n.length){var m=yE(s,p);f=!!m,f&&"get"in m&&!("originalValue"in m.get)?s=m.get:s=s[p]}else f=sQ(s,p),s=s[p];f&&!a&&(EE[o]=s)}}return s}});var cQ=L((vTu,lAt)=>{"use strict";var l7n=ZC(),Q9e=l7n("%Object.defineProperty%",!0),Z9e=function(){if(Q9e)try{return Q9e({},"a",{value:1}),!0}catch{return!1}return!1};Z9e.hasArrayLengthDefineBug=function(){if(!Z9e())return null;try{return Q9e([],"length",{value:1}).length!==1}catch{return!0}};lAt.exports=Z9e});var e4e=L((DTu,fAt)=>{"use strict";var f7n=ZC(),lQ=f7n("%Object.getOwnPropertyDescriptor%",!0);if(lQ)try{lQ([],"length")}catch{lQ=null}fAt.exports=lQ});var r4e=L((yTu,hAt)=>{"use strict";var p7n=cQ()(),t4e=ZC(),GP=p7n&&t4e("%Object.defineProperty%",!0);if(GP)try{GP({},"a",{value:1})}catch{GP=!1}var h7n=t4e("%SyntaxError%"),ex=t4e("%TypeError%"),pAt=e4e();hAt.exports=function(t,r,n){if(!t||typeof t!="object"&&typeof t!="function")throw new ex("`obj` must be an object or a function`");if(typeof r!="string"&&typeof r!="symbol")throw new ex("`property` must be a string or a symbol`");if(arguments.length>3&&typeof arguments[3]!="boolean"&&arguments[3]!==null)throw new ex("`nonEnumerable`, if provided, must be a boolean or null");if(arguments.length>4&&typeof arguments[4]!="boolean"&&arguments[4]!==null)throw new ex("`nonWritable`, if provided, must be a boolean or null");if(arguments.length>5&&typeof arguments[5]!="boolean"&&arguments[5]!==null)throw new ex("`nonConfigurable`, if provided, must be a boolean or null");if(arguments.length>6&&typeof arguments[6]!="boolean")throw new ex("`loose`, if provided, must be a boolean");var u=arguments.length>3?arguments[3]:null,i=arguments.length>4?arguments[4]:null,o=arguments.length>5?arguments[5]:null,s=arguments.length>6?arguments[6]:!1,a=!!pAt&&pAt(t,r);if(GP)GP(t,r,{configurable:o===null&&a?a.configurable:!o,enumerable:u===null&&a?a.enumerable:!u,value:n,writable:i===null&&a?a.writable:!i});else if(s||!u&&!i&&!o)t[r]=n;else throw new h7n("This environment does not support defining a property as non-configurable, non-writable, or non-enumerable.")}});var n4e=L((ETu,vAt)=>{"use strict";var d7n=Wxt(),m7n=typeof Symbol=="function"&&typeof Symbol("foo")=="symbol",g7n=Object.prototype.toString,v7n=Array.prototype.concat,dAt=r4e(),D7n=function(e){return typeof e=="function"&&g7n.call(e)==="[object Function]"},mAt=cQ()(),y7n=function(e,t,r,n){if(t in e){if(n===!0){if(e[t]===r)return}else if(!D7n(n)||!n())return}mAt?dAt(e,t,r,!0):dAt(e,t,r)},gAt=function(e,t){var r=arguments.length>2?arguments[2]:{},n=d7n(t);m7n&&(n=v7n.call(n,Object.getOwnPropertySymbols(t)));for(var u=0;u<n.length;u+=1)y7n(e,n[u],t[n[u]],r[n[u]])};gAt.supportsDescriptors=!!mAt;vAt.exports=gAt});var u4e=L((bTu,DAt)=>{"use strict";DAt.exports=global});var i4e=L((CTu,yAt)=>{"use strict";var E7n=u4e();yAt.exports=function(){return typeof global!="object"||!global||global.Math!==Math||global.Array!==Array?E7n:global}});var bAt=L((xTu,EAt)=>{"use strict";var b7n=n4e(),C7n=i4e();EAt.exports=function(){var t=C7n();if(b7n.supportsDescriptors){var r=Object.getOwnPropertyDescriptor(t,"globalThis");(!r||r.configurable&&(r.enumerable||!r.writable||globalThis!==t))&&Object.defineProperty(t,"globalThis",{configurable:!0,enumerable:!1,value:t,writable:!0})}else(typeof globalThis!="object"||globalThis!==t)&&(t.globalThis=t);return t}});var o4e=L((ATu,AAt)=>{"use strict";var x7n=n4e(),A7n=u4e(),CAt=i4e(),F7n=bAt(),_7n=CAt(),xAt=function(){return _7n};x7n(xAt,{getPolyfill:CAt,implementation:A7n,shim:F7n});AAt.exports=xAt});var BAt=L((s4e,_At)=>{s4e=_At.exports=B7n;s4e.getSerialize=FAt;function B7n(e,t,r,n){return JSON.stringify(e,FAt(t,n),r)}function FAt(e,t){var r=[],n=[];return t==null&&(t=function(u,i){return r[0]===i?"[Circular ~]":"[Circular ~."+n.slice(0,r.indexOf(i)).join(".")+"]"}),function(u,i){if(r.length>0){var o=r.indexOf(this);~o?r.splice(o+1):r.push(this),~o?n.splice(o,1/0,u):n.push(u),~r.indexOf(i)&&(i=t.call(this,u,i))}else r.push(i);return e==null?i:e.call(this,u,i)}}});var wAt=L(fQ=>{(function(){"use strict";var e={not_string:/[^s]/,not_bool:/[^t]/,not_type:/[^T]/,not_primitive:/[^v]/,number:/[diefg]/,numeric_arg:/[bcdiefguxX]/,json:/[j]/,not_json:/[^j]/,text:/^[^\x25]+/,modulo:/^\x25{2}/,placeholder:/^\x25(?:([1-9]\d*)\$|\(([^)]+)\))?(\+)?(0|'[^$])?(-)?(\d+)?(?:\.(\d+))?([b-gijostTuvxX])/,key:/^([a-z_][a-z_\d]*)/i,key_access:/^\.([a-z_][a-z_\d]*)/i,index_access:/^\[(\d+)\]/,sign:/^[+-]/};function t(o){return n(i(o),arguments)}function r(o,s){return t.apply(null,[o].concat(s||[]))}function n(o,s){var a=1,c=o.length,l,f="",p,h,d,m,v,y,g,D;for(p=0;p<c;p++)if(typeof o[p]=="string")f+=o[p];else if(typeof o[p]=="object"){if(d=o[p],d.keys)for(l=s[a],h=0;h<d.keys.length;h++){if(l==null)throw new Error(t('[sprintf] Cannot access property "%s" of undefined value "%s"',d.keys[h],d.keys[h-1]));l=l[d.keys[h]]}else d.param_no?l=s[d.param_no]:l=s[a++];if(e.not_type.test(d.type)&&e.not_primitive.test(d.type)&&l instanceof Function&&(l=l()),e.numeric_arg.test(d.type)&&typeof l!="number"&&isNaN(l))throw new TypeError(t("[sprintf] expecting number but found %T",l));switch(e.number.test(d.type)&&(g=l>=0),d.type){case"b":l=parseInt(l,10).toString(2);break;case"c":l=String.fromCharCode(parseInt(l,10));break;case"d":case"i":l=parseInt(l,10);break;case"j":l=JSON.stringify(l,null,d.width?parseInt(d.width):0);break;case"e":l=d.precision?parseFloat(l).toExponential(d.precision):parseFloat(l).toExponential();break;case"f":l=d.precision?parseFloat(l).toFixed(d.precision):parseFloat(l);break;case"g":l=d.precision?String(Number(l.toPrecision(d.precision))):parseFloat(l);break;case"o":l=(parseInt(l,10)>>>0).toString(8);break;case"s":l=String(l),l=d.precision?l.substring(0,d.precision):l;break;case"t":l=String(!!l),l=d.precision?l.substring(0,d.precision):l;break;case"T":l=Object.prototype.toString.call(l).slice(8,-1).toLowerCase(),l=d.precision?l.substring(0,d.precision):l;break;case"u":l=parseInt(l,10)>>>0;break;case"v":l=l.valueOf(),l=d.precision?l.substring(0,d.precision):l;break;case"x":l=(parseInt(l,10)>>>0).toString(16);break;case"X":l=(parseInt(l,10)>>>0).toString(16).toUpperCase();break}e.json.test(d.type)?f+=l:(e.number.test(d.type)&&(!g||d.sign)?(D=g?"+":"-",l=l.toString().replace(e.sign,"")):D="",v=d.pad_char?d.pad_char==="0"?"0":d.pad_char.charAt(1):" ",y=d.width-(D+l).length,m=d.width&&y>0?v.repeat(y):"",f+=d.align?D+l+m:v==="0"?D+m+l:m+D+l)}return f}var u=Object.create(null);function i(o){if(u[o])return u[o];for(var s=o,a,c=[],l=0;s;){if((a=e.text.exec(s))!==null)c.push(a[0]);else if((a=e.modulo.exec(s))!==null)c.push("%");else if((a=e.placeholder.exec(s))!==null){if(a[2]){l|=1;var f=[],p=a[2],h=[];if((h=e.key.exec(p))!==null)for(f.push(h[1]);(p=p.substring(h[0].length))!=="";)if((h=e.key_access.exec(p))!==null)f.push(h[1]);else if((h=e.index_access.exec(p))!==null)f.push(h[1]);else throw new SyntaxError("[sprintf] failed to parse named argument key");else throw new SyntaxError("[sprintf] failed to parse named argument key");a[2]=f}else l|=2;if(l===3)throw new Error("[sprintf] mixing positional and named placeholders is not (yet) supported");c.push({placeholder:a[0],param_no:a[1],keys:a[2],sign:a[3],pad_char:a[4],align:a[5],width:a[6],precision:a[7],type:a[8]})}else throw new SyntaxError("[sprintf] unexpected placeholder");s=s.substring(a[0].length)}return u[o]=c}typeof fQ<"u"&&(fQ.sprintf=t,fQ.vsprintf=r),typeof window<"u"&&(window.sprintf=t,window.vsprintf=r,typeof define=="function"&&define.amd&&define(function(){return{sprintf:t,vsprintf:r}}))})()});var a4e=L(pQ=>{"use strict";Object.defineProperty(pQ,"__esModule",{value:!0});pQ.logLevels=void 0;var w7n={debug:20,error:50,fatal:60,info:30,trace:10,warn:40};pQ.logLevels=w7n});var TAt=L(dQ=>{"use strict";Object.defineProperty(dQ,"__esModule",{value:!0});dQ.default=void 0;var S7n=p4e(nQ()),O7n=p4e(o4e()),T7n=p4e(BAt()),c4e=wAt(),SAt=a4e();function p4e(e){return e&&e.__esModule?e:{default:e}}function l4e(){return l4e=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},l4e.apply(this,arguments)}function OAt(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(u){return Object.getOwnPropertyDescriptor(e,u).enumerable})),r.push.apply(r,n)}return r}function Ff(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?OAt(Object(r),!0).forEach(function(n){P7n(e,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):OAt(Object(r)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(r,n))})}return e}function P7n(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}var k7n=(0,O7n.default)(),VP;S7n.default&&(VP=require("domain"));var R7n=()=>{if(!VP)return{};let e=[],t=process.domain;if(!t||!t.parentDomain)return{};for(;t&&t.parentDomain;)t=t.parentDomain,t.roarr&&t.roarr.context&&e.push(t.roarr.context);let r={};for(let n of e)r=Ff(Ff({},r),n);return r},hQ=()=>{if(!VP)return{};let e=process.domain;if(e&&e.roarr&&e.roarr.context)return e.roarr.context;if(!e||!e.parentDomain)return{};for(;e&&e.parentDomain;)if(e=e.parentDomain,e.roarr&&e.roarr.context)return e.roarr.context;return{}},f4e=(e,t)=>{let r=(n,u,i,o,s,a,c,l,f,p)=>{let h=Date.now(),d=k7n.ROARR.sequence++,m,v;if(typeof n=="string"){m=Ff(Ff({},hQ()),t||{});let y=l4e({},{a:n,b:u,c:i,d:o,e:s,f:a,g:c,h:l,i:f,k:p});v=Object.keys(y).map(E=>y[E]).reduce((E,b)=>E+=typeof b>"u"?0:1,0)===1?(0,c4e.sprintf)("%s",n):(0,c4e.sprintf)(n,u,i,o,s,a,c,l,f,p)}else{if(typeof u!="string")throw new TypeError("Message must be a string.");m=JSON.parse((0,T7n.default)(Ff(Ff(Ff({},hQ()),t||{}),n))),v=(0,c4e.sprintf)(u,i,o,s,a,c,l,f,p)}e({context:m,message:v,sequence:d,time:h,version:"1.0.0"})};r.child=n=>typeof n=="function"?f4e(u=>{if(typeof n!="function")throw new TypeError("Unexpected state.");e(n(u))},t):f4e(e,Ff(Ff(Ff({},hQ()),t),n)),r.getContext=()=>Ff(Ff({},hQ()),t||{}),r.adopt=async(n,u)=>{if(!VP)return n();let i=VP.create();return i.run(()=>(i.roarr={context:Ff(Ff({},R7n()),u)},n()))};for(let n of Object.keys(SAt.logLevels))r[n]=(u,i,o,s,a,c,l,f,p,h)=>r.child({logLevel:SAt.logLevels[n]})(u,i,o,s,a,c,l,f,p,h);return r},I7n=f4e;dQ.default=I7n});var RAt=L(mQ=>{"use strict";Object.defineProperty(mQ,"__esModule",{value:!0});mQ.default=void 0;var PAt=a4e(),kAt=(e,t)=>{let r=(n,u,i,o,s,a,c,l,f,p)=>{};r.adopt=async n=>n(),r.child=n=>kAt(e,t),r.getContext=()=>({});for(let n of Object.keys(PAt.logLevels))r[n]=(u,i,o,s,a,c,l,f,p,h)=>r.child({logLevel:PAt.logLevels[n]})(u,i,o,s,a,c,l,f,p,h);return r},j7n=kAt;mQ.default=j7n});var jAt=L((STu,IAt)=>{IAt.exports=function(t,r){for(var n=t.split("."),u=r.split("."),i=0;i<3;i++){var o=Number(n[i]),s=Number(u[i]);if(o>s)return 1;if(s>o)return-1;if(!isNaN(o)&&isNaN(s))return 1;if(isNaN(o)&&!isNaN(s))return-1}return 0}});var LAt=L((OTu,L7n)=>{L7n.exports={author:{email:"gajus@gajus.com",name:"Gajus Kuizinas",url:"http://gajus.com"},ava:{babel:{compileAsTests:["test/helpers/**/*"]},files:["test/roarr/**/*"],require:["@babel/register"]},dependencies:{boolean:"^3.0.1","detect-node":"^2.0.4",globalthis:"^1.0.1","json-stringify-safe":"^5.0.1","semver-compare":"^1.0.0","sprintf-js":"^1.1.2"},description:"JSON logger for Node.js and browser.",devDependencies:{"@ava/babel":"^1.0.1","@babel/cli":"^7.11.6","@babel/core":"^7.11.6","@babel/node":"^7.10.5","@babel/plugin-transform-flow-strip-types":"^7.10.4","@babel/preset-env":"^7.11.5","@babel/register":"^7.11.5",ava:"^3.12.1","babel-plugin-istanbul":"^6.0.0","babel-plugin-transform-export-default-name":"^2.0.4",coveralls:"^3.1.0","domain-parent":"^1.0.0",eslint:"^7.9.0","eslint-config-canonical":"^24.1.1","flow-bin":"^0.133.0","flow-copy-source":"^2.0.9",gitdown:"^3.1.3",husky:"^4.3.0",nyc:"^15.1.0","semantic-release":"^17.1.1"},engines:{node:">=8.0"},husky:{hooks:{"pre-commit":"npm run lint && npm run test && npm run build","pre-push":"gitdown ./.README/README.md --output-file ./README.md --check"}},keywords:["log","logger","json"],main:"./dist/log.js",name:"roarr",nyc:{include:["src/**/*.js"],instrument:!1,reporter:["text-lcov"],require:["@babel/register"],sourceMap:!1},license:"BSD-3-Clause",repository:{type:"git",url:"git@github.com:gajus/roarr.git"},scripts:{build:"rm -fr ./dist && NODE_ENV=production babel ./src --out-dir ./dist --copy-files --source-maps && flow-copy-source src dist","create-readme":"gitdown ./.README/README.md --output-file ./README.md",dev:"NODE_ENV=production babel ./src --out-dir ./dist --copy-files --source-maps --watch",lint:"eslint ./src ./test && flow",test:"NODE_ENV=test ava --serial --verbose"},version:"2.15.4"}});var NAt=L(gQ=>{"use strict";Object.defineProperty(gQ,"__esModule",{value:!0});gQ.default=void 0;var N7n=e=>({write:t=>{e.write(t+`
@@ -578,9 +578,9 @@ Calls to async() callback can have unexpected results.`),l=!0,function(d,m){d?c(
578
578
  `;return}if(u.disabled)n++,r+=" - "+u.name,r+=` (${typeof u.disabled=="string"?u.disabled:"Disabled"})`;else{let o=eSn(u.checked)+" "+u.name;i-n===t?r+=Tg.cyan(Jxe.pointer+o):r+=" "+o}r+=`
579
579
  `}),r.replace(/\n$/,"")}function eSn(e){return e?Tg.green(Jxe.radioOn):Jxe.radioOff}MPt.exports=Qxe});var WPt=L((Vju,zPt)=>{"use strict";var gee=Ol(),{map:tSn,takeUntil:rSn}=vo(),nSn=F5(),uSn=_5();function $Pt(e,t){return e=String(e),t=typeof t=="string"?t:"*",e.length===0?"":new Array(e.length+1).join(t)}var Zxe=class extends nSn{_run(t){this.done=t;let r=uSn(this.rl),n=r.line.pipe(tSn(this.filterInput.bind(this))),u=this.handleSubmitEvents(n);return u.success.forEach(this.onEnd.bind(this)),u.error.forEach(this.onError.bind(this)),r.keypress.pipe(rSn(u.success)).forEach(this.onKeypress.bind(this)),this.render(),this}render(t){let r=this.getQuestion(),n="";this.status==="answered"?r+=this.getMaskedValue(this.answer):r+=this.getMaskedValue(this.rl.line||""),t&&(n=`
580
580
  `+gee.red(">> ")+t),this.screen.render(r,n)}getMaskedValue(t){return this.status==="answered"?this.opt.mask?gee.cyan($Pt(t,this.opt.mask)):gee.italic.dim("[hidden]"):this.opt.mask?$Pt(t,this.opt.mask):gee.italic.dim("[input is hidden] ")}getSpinningValue(t){return this.getMaskedValue(t)}filterInput(t){return t||(this.opt.default==null?"":this.opt.default)}onEnd(t){this.status="answered",this.answer=t.value,this.render(),this.screen.done(),this.done(t.value)}onError(t){this.render(t.isValid)}onKeypress(){this.opt.default&&(this.opt.default=void 0),this.render()}};zPt.exports=Zxe});var VPt=L((Hju,GPt)=>{"use strict";var eAe=Ol(),{editAsync:iSn}=GK(),oSn=F5(),sSn=_5(),{Subject:aSn}=jo(),tAe=class extends oSn{_run(t){this.done=t,this.editorResult=new aSn;let r=sSn(this.rl);this.lineSubscription=r.line.subscribe(this.startExternalEditor.bind(this));let n=this.handleSubmitEvents(this.editorResult);return n.success.forEach(this.onEnd.bind(this)),n.error.forEach(this.onError.bind(this)),this.currentText=this.opt.default,this.opt.default=null,this.render(),this}render(t){let r="",n=this.getQuestion();this.status==="answered"?n+=eAe.dim("Received"):n+=eAe.dim("Press <enter> to launch your preferred editor."),t&&(r=eAe.red(">> ")+t),this.screen.render(n,r)}startExternalEditor(){this.rl.pause(),iSn(this.currentText,this.endExternalEditor.bind(this))}endExternalEditor(t,r){this.rl.resume(),t?this.editorResult.error(t):this.editorResult.next(r)}onEnd(t){this.editorResult.unsubscribe(),this.lineSubscription.unsubscribe(),this.answer=t.value,this.status="answered",this.render(),this.screen.done(),this.done(this.answer)}onError(t){this.render(t.isValid)}};GPt.exports=tAe});var rAe=L((Kju,HPt)=>{"use strict";var gd=HPt.exports;gd.prompts={};gd.Separator=rR();gd.ui={BottomBar:MTt(),Prompt:KTt()};gd.createPromptModule=function(e){let t=function(r,n){let u;try{u=new gd.ui.Prompt(t.prompts,e)}catch(o){return Promise.reject(o)}let i=u.run(r,n);return i.ui=u,i};return t.prompts={},t.registerPrompt=function(r,n){return t.prompts[r]=n,this},t.restoreDefaultPrompts=function(){this.registerPrompt("list",BPt()),this.registerPrompt("input",Wxe()),this.registerPrompt("number",TPt()),this.registerPrompt("confirm",kPt()),this.registerPrompt("rawlist",IPt()),this.registerPrompt("expand",LPt()),this.registerPrompt("checkbox",UPt()),this.registerPrompt("password",WPt()),this.registerPrompt("editor",VPt())},t.restoreDefaultPrompts(),t};gd.prompt=gd.createPromptModule();gd.registerPrompt=function(e,t){gd.prompt.registerPrompt(e,t)};gd.restoreDefaultPrompts=function(){gd.prompt.restoreDefaultPrompts()}});var XPt=L(w5=>{"use strict";var vd=w5&&w5.__awaiter||function(e,t,r,n){function u(i){return i instanceof r?i:new r(function(o){o(i)})}return new(r||(r=Promise))(function(i,o){function s(l){try{c(n.next(l))}catch(f){o(f)}}function a(l){try{c(n.throw(l))}catch(f){o(f)}}function c(l){l.done?i(l.value):u(l.value).then(s,a)}c((n=n.apply(e,t||[])).next())})},cSn=w5&&w5.__rest||function(e,t){var r={};for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&t.indexOf(n)<0&&(r[n]=e[n]);if(e!=null&&typeof Object.getOwnPropertySymbols=="function")for(var u=0,n=Object.getOwnPropertySymbols(e);u<n.length;u++)t.indexOf(n[u])<0&&Object.prototype.propertyIsEnumerable.call(e,n[u])&&(r[n[u]]=e[n[u]]);return r},Up=w5&&w5.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(w5,"__esModule",{value:!0});var l2=Up(require("path")),$c=Up(ro()),lSn=Up(kJ()),fSn=Up(Bbe()),pSn=Up(gwt()),B5=Hr(),Uu=ar(),hSn=Up(qX()),dSn=Up(fxe()),Kx=Cxe(),mSn=Up(require("assert")),KPt=Up(cxe()),vee=Up(rAe()),gSn=Up(Ol()),YPt=Up(yl()),lR=$x(),nAe=ed()("serverless-devs:load-appliaction"),uAe=class{constructor(t,r={}){this.template=t,this.options=r,this.secretList=[],this.getZipballUrl=()=>vd(this,void 0,void 0,function*(){let i=this.version?(0,Kx.getUrlWithVersion)(this.name,this.version):(0,Kx.getUrlWithLatest)(this.name);nAe(`url: ${i}`);let o=yield hSn.default.get(i,{headers:B5.registry.getSignHeaders()});nAe(`res: ${JSON.stringify(o.data)}`);let s=(0,Uu.get)(o,"data.body.zipball_url"),a=this.version?`${this.name}@${this.version}`:this.name;if((0,Uu.isEmpty)(s))throw new Error(`Application ${a} is not found`);return s}),(0,mSn.default)(!(0,Uu.includes)(this.template,"/"),`The component name ${this.template} cannot contain /`),this.options.dest=this.options.dest||process.cwd(),this.options.logger=this.options.logger||console;let[n,u]=(0,Uu.split)(this.template,"@");this.name=n,this.version=u,this.options.projectName=this.options.projectName||n,this.filePath=l2.default.join(this.options.dest,this.options.projectName),this.tempPath=`${this.filePath}_${Date.now()}`}run(){return vd(this,void 0,void 0,function*(){if(!(yield this.check()))return;yield this.doLoad(),yield this.preInit(),yield this.parsePublishYaml();let r=(yield this.postInit())||{},{_custom_secret_list:n}=r,u=cSn(r,["_custom_secret_list"]);this.secretList=(0,Uu.concat)(this.secretList,(0,Uu.keys)(n));let i=yield this.parseTemplateYaml(u);return this.parseAppName(i),yield this.final(),this.filePath})}check(){return vd(this,void 0,void 0,function*(){return this.options.y||(0,B5.isCiCdEnvironment)()||!$c.default.existsSync(this.filePath)?!0:(yield vee.default.prompt([{type:"confirm",name:"confirm",message:`File ${this.options.projectName} already exists, override this file ?`,default:!0}])).confirm})}final(){return vd(this,void 0,void 0,function*(){if(!(0,Uu.isEmpty)(this.secretList)){let t=l2.default.join(this.filePath,".env");$c.default.ensureFileSync(t);let r=(0,Uu.map)(this.secretList,n=>`
581
- ${n}=${this.publishData[n]}`).join("");$c.default.appendFileSync(t,r,"utf-8")}$c.default.removeSync(this.tempPath)})}parseAppName(t){if((0,Uu.isEmpty)(this.spath))return;let r=t||$c.default.readFileSync(this.spath,"utf-8"),{appName:n}=this.options;if((0,Uu.isEmpty)(n))return;let u=(0,dSn.default)({appName:n},r);$c.default.writeFileSync(this.spath,u,"utf-8")}parseTemplateYaml(t){return vd(this,void 0,void 0,function*(){if(!(0,Uu.isEmpty)(this.publishData))return this.publishData=Object.assign(Object.assign({},this.publishData),t),this.doArtTemplate(this.spath)})}doArtTemplate(t){let r=(0,B5.getYamlContent)(this.publishPath),n=(0,Uu.get)(r,"Parameters.jsonParse"),u=n?pSn.default:fSn.default;u.defaults.extname=l2.default.extname(t),(0,Uu.set)(u.defaults,"escape",!1);let i=l2.default.join(this.tempPath,"hook","filter.js");if($c.default.existsSync(i)){let s=require(i);for(let a in s)u.defaults.imports[a]=s[a]}if(n){let s=(0,Kx.getInputs)((0,B5.getYamlContent)(t),this.publishData,u);return $c.default.writeFileSync(t,KPt.default.stringify(s),"utf-8"),KPt.default.stringify(s)}let o=u(t,this.publishData);return $c.default.writeFileSync(t,o,"utf-8"),o}postInit(){return vd(this,void 0,void 0,function*(){let t=l2.default.join(this.tempPath,"hook");if(!$c.default.existsSync(t))return;let{logger:r}=this.options,n=yield require(t),u={name:this.name,version:this.version,appPath:this.filePath,tempAppPath:this.tempPath,logger:r,fs:$c.default,lodash:ar(),artTemplate:i=>{this.doArtTemplate(l2.default.join(this.filePath,i))}};try{return yield n.postInit(u)}catch(i){r.debug(i)}})}parsePublishYaml(){return vd(this,void 0,void 0,function*(){if(this.publishPath=l2.default.join(this.tempPath,"publish.yaml"),!$c.default.existsSync(this.publishPath))return;$c.default.emptyDirSync(this.filePath),$c.default.copySync(l2.default.join(this.tempPath,"src"),this.filePath);let t=(0,B5.getYamlPath)(l2.default.join(this.filePath,"s.yaml"));if((0,Uu.isEmpty)(t))return;this.spath=t;let{parameters:r={}}=this.options;if(!(0,Uu.isEmpty)(r)||(0,B5.isCiCdEnvironment)()){let n=this.parsePublishWithParameters();this.publishData=Object.assign(Object.assign({},n),{access:this.options.access});return}this.options.y||(this.publishData=yield this.parsePublishWithInquire())})}parsePublishWithInquire(){return vd(this,void 0,void 0,function*(){let t=(0,B5.getYamlContent)(this.publishPath),r=(0,Uu.get)(t,"Parameters.properties"),n=(0,Uu.get)(t,"Parameters.required"),u=[];if(r){let s=[];for(let a in r){let c=r[a];c.__key=a,s.push(c)}s=(0,Uu.sortBy)(s,a=>a["x-range"]);for(let a of s){let c=a.__key,l=a.description?`${(0,lR.gray)(a.description)}
581
+ ${n}=${this.publishData[n]}`).join("");$c.default.appendFileSync(t,r,"utf-8")}$c.default.removeSync(this.tempPath)})}parseAppName(t){if((0,Uu.isEmpty)(this.spath))return;let r=t||$c.default.readFileSync(this.spath,"utf-8"),{appName:n}=this.options;if((0,Uu.isEmpty)(n))return;let u=(0,dSn.default)({appName:n},r);$c.default.writeFileSync(this.spath,u,"utf-8")}parseTemplateYaml(t){return vd(this,void 0,void 0,function*(){if(!(0,Uu.isEmpty)(this.publishData))return this.publishData=Object.assign(Object.assign({},this.publishData),t),this.doArtTemplate(this.spath)})}doArtTemplate(t){let r=(0,B5.getYamlContent)(this.publishPath),n=(0,Uu.get)(r,"Parameters.jsonParse"),u=n?pSn.default:fSn.default;u.defaults.extname=l2.default.extname(t),(0,Uu.set)(u.defaults,"escape",!1);let i=l2.default.join(this.tempPath,"hook","filter.js");if($c.default.existsSync(i)){let s=require(i);for(let a in s)u.defaults.imports[a]=s[a]}if(n){let s=(0,Kx.getInputs)((0,B5.getYamlContent)(t),this.publishData,u);return $c.default.writeFileSync(t,KPt.default.stringify(s),"utf-8"),KPt.default.stringify(s)}let o=u(t,this.publishData);return $c.default.writeFileSync(t,o,"utf-8"),o}postInit(){return vd(this,void 0,void 0,function*(){let t=l2.default.join(this.tempPath,"hook");if(!$c.default.existsSync(t))return;let{logger:r}=this.options,n=yield require(t),u={name:this.name,version:this.version,appPath:this.filePath,tempAppPath:this.tempPath,logger:r,fs:$c.default,lodash:ar(),artTemplate:i=>{this.doArtTemplate(l2.default.join(this.filePath,i))}};try{return yield n.postInit(u)}catch(i){r.debug(i)}})}parsePublishYaml(){return vd(this,void 0,void 0,function*(){if(this.publishPath=l2.default.join(this.tempPath,"publish.yaml"),!$c.default.existsSync(this.publishPath))return;this.options.overwrite!==!1&&$c.default.emptyDirSync(this.filePath),$c.default.copySync(l2.default.join(this.tempPath,"src"),this.filePath);let t=(0,B5.getYamlPath)(l2.default.join(this.filePath,"s.yaml"));if((0,Uu.isEmpty)(t))return;this.spath=t;let{parameters:r={}}=this.options;if(!(0,Uu.isEmpty)(r)||(0,B5.isCiCdEnvironment)()){let n=this.parsePublishWithParameters();this.publishData=Object.assign(Object.assign({},n),{access:this.options.access});return}this.options.y||(this.publishData=yield this.parsePublishWithInquire())})}parsePublishWithInquire(){return vd(this,void 0,void 0,function*(){let t=(0,B5.getYamlContent)(this.publishPath),r=(0,Uu.get)(t,"Parameters.properties"),n=(0,Uu.get)(t,"Parameters.required"),u=[];if(r){let s=[];for(let a in r){let c=r[a];c.__key=a,s.push(c)}s=(0,Uu.sortBy)(s,a=>a["x-range"]);for(let a of s){let c=a.__key,l=a.description?`${(0,lR.gray)(a.description)}
582
582
  ${gSn.default.green("?")}`:void 0,f=p=>(0,Uu.isEmpty)(p)?(0,Uu.includes)(n,c)?"value cannot be empty.":!0:a.pattern?new RegExp(a.pattern).test(p)?!0:a.description:!0;a.type==="boolean"?u.push({type:"confirm",name:c,prefix:l,message:a.title,default:a.default}):a.type==="secret"?(this.secretList.push(c),u.push({type:"password",name:c,prefix:l,message:a.title,default:a.default,validate:f})):a.enum?u.push({type:"list",name:c,prefix:l,message:a.title,choices:a.enum,default:a.default}):a.type==="string"&&u.push({type:"input",message:a.title,name:c,prefix:l,default:(0,Kx.getDefaultValue)(a.default),validate:f})}}let i=(0,Uu.map)(yield(0,Kx.getAllCredential)({logger:this.options.logger}),s=>({name:s,value:s})),o={};if(this.options.access)o=yield vee.default.prompt(u),o.access=yield this.getCredentialDirectly();else if((0,Uu.isEmpty)(i))if(u.push({type:"confirm",name:"__access",message:"create credential?",default:!0}),o=yield vee.default.prompt(u),(0,Uu.get)(o,"__access")){let s=yield new YPt.default({logger:this.options.logger}).set();o.access=s==null?void 0:s.access}else o.access=lR.DEFAULT_MAGIC_ACCESS;else u.push({type:"list",name:"access",message:"please select credential alias",choices:(0,Uu.concat)(i,{name:"configure later.",value:lR.CONFIGURE_LATER})}),o=yield vee.default.prompt(u),o.alias===lR.CONFIGURE_LATER&&(o.access=lR.DEFAULT_MAGIC_ACCESS);return o})}getCredentialDirectly(){return vd(this,void 0,void 0,function*(){let{logger:t}=this.options,r=new YPt.default({logger:this.options.logger});try{let n=yield r.get(this.options.access);return n==null?void 0:n.access}catch(n){let u=n;t.tips(u.message);let i=yield r.set();return i==null?void 0:i.access}})}parsePublishWithParameters(){let t=(0,B5.getYamlContent)(this.publishPath),r=(0,Uu.get)(t,"Parameters.properties",{}),n=(0,Uu.get)(t,"Parameters.required",[]),{parameters:u={}}=this.options,i={};for(let o in r){let s=r[o];if((0,Uu.has)(u,o))(0,Uu.set)(i,o,u[o]);else if(s.hasOwnProperty("default"))(0,Uu.set)(i,o,(0,Kx.getDefaultValue)(s.default));else if((0,Uu.includes)(n,o))throw new Error(`parameter ${o} is required`)}return i}preInit(){return vd(this,void 0,void 0,function*(){let t=l2.default.join(this.tempPath,"hook");if(!$c.default.existsSync(t))return;let{logger:r}=this.options,n=yield require(t),u={name:this.name,version:this.version,appPath:this.filePath,tempAppPath:this.tempPath,logger:r,fs:$c.default,lodash:ar()};try{yield n.preInit(u)}catch(i){r.debug(i)}})}doLoad(){return vd(this,void 0,void 0,function*(){let{logger:t}=this.options,r=this.options.uri||(yield this.getZipballUrl());nAe(`zipball_url: ${r}`),yield(0,lSn.default)(r,{dest:this.tempPath,logger:t,extract:!0,headers:B5.registry.getSignHeaders(),filename:this.name})})}};w5.default=uAe});var JPt=L(fR=>{"use strict";Object.defineProperty(fR,"__esModule",{value:!0});fR.IProvider=void 0;var vSn;(function(e){e.DEVSAPP="devsapp",e.PERSONAL="personal"})(vSn=fR.IProvider||(fR.IProvider={}))});var ekt=L(S5=>{"use strict";var Dd=S5&&S5.__awaiter||function(e,t,r,n){function u(i){return i instanceof r?i:new r(function(o){o(i)})}return new(r||(r=Promise))(function(i,o){function s(l){try{c(n.next(l))}catch(f){o(f)}}function a(l){try{c(n.throw(l))}catch(f){o(f)}}function c(l){l.done?i(l.value):u(l.value).then(s,a)}c((n=n.apply(e,t||[])).next())})},DSn=S5&&S5.__rest||function(e,t){var r={};for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&t.indexOf(n)<0&&(r[n]=e[n]);if(e!=null&&typeof Object.getOwnPropertySymbols=="function")for(var u=0,n=Object.getOwnPropertySymbols(e);u<n.length;u++)t.indexOf(n[u])<0&&Object.prototype.propertyIsEnumerable.call(e,n[u])&&(r[n[u]]=e[n[u]]);return r},p2=S5&&S5.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(S5,"__esModule",{value:!0});var f2=p2(require("path")),Sf=p2(ro()),QPt=p2(qX()),ySn=p2(kJ()),Dee=p2(Bbe()),yee=Hr(),Au=ar(),ESn=p2(fxe()),Yx=JPt(),Pg=$x(),iAe=Cxe(),oAe=p2(rAe()),bSn=p2(Ol()),ZPt=p2(yl()),CSn=$x(),xSn=p2(require("assert")),Eee=ed()("serverless-devs:load-appliaction"),sAe=class{constructor(t,r={}){this.template=t,this.options=r,this.secretList=[],this.options.dest=this.options.dest||process.cwd(),this.options.logger=this.options.logger||console;let{provider:n,name:u,version:i}=this.format();this.provider=n,this.name=u,this.version=i,this.options.projectName=this.options.projectName||u,this.filePath=f2.default.join(this.options.dest,this.options.projectName),this.tempPath=`${this.filePath}_${Date.now()}`}formatProvider(){if((0,Au.includes)(this.template,"/")){let[r,n]=(0,Au.split)(this.template,"/");return(0,xSn.default)(r===Yx.IProvider.DEVSAPP,`The provider ${r} is invalid, only support devsapp`),{provider:r,componentName:n}}return{provider:Yx.IProvider.PERSONAL,componentName:this.template}}format(){let{provider:t,componentName:r}=this.formatProvider(),[n,u]=(0,Au.split)(r,"@");return{provider:t,name:n,version:u}}run(){return Dd(this,void 0,void 0,function*(){yield this.doLoad(),yield this.preInit(),yield this.parsePublishYaml();let r=(yield this.postInit())||{},{_custom_secret_list:n}=r,u=DSn(r,["_custom_secret_list"]);this.secretList=(0,Au.concat)(this.secretList,(0,Au.keys)(n));let i=yield this.parseTemplateYaml(u);return this.parseAppName(i),yield this.final(),this.filePath})}final(){return Dd(this,void 0,void 0,function*(){if(this.secretList.length>0){let t=f2.default.join(this.filePath,".env");Sf.default.ensureFileSync(t);let r=(0,Au.map)(this.secretList,n=>`
583
- ${n}=${this.publishData[n]}`).join("");Sf.default.appendFileSync(t,r,"utf-8")}Sf.default.removeSync(this.tempPath)})}parseAppName(t){if((0,Au.isEmpty)(this.spath))return;let r=t||Sf.default.readFileSync(this.spath,"utf-8"),{appName:n}=this.options;if((0,Au.isEmpty)(n))return;let u=(0,ESn.default)({appName:n},r);Sf.default.writeFileSync(this.spath,u,"utf-8")}parseTemplateYaml(t){return Dd(this,void 0,void 0,function*(){if(!(0,Au.isEmpty)(this.publishData))return this.publishData=Object.assign(Object.assign({},this.publishData),t),this.doArtTemplate(this.spath)})}doArtTemplate(t){Dee.default.defaults.extname=f2.default.extname(t),(0,Au.set)(Dee.default.defaults,"escape",!1);let r=f2.default.join(this.tempPath,"hook","filter.js");if(Sf.default.existsSync(r)){let u=require(r);for(let i in u)Dee.default.defaults.imports[i]=u[i]}let n=(0,Dee.default)(t,this.publishData);return Sf.default.writeFileSync(t,n,"utf-8"),n}postInit(){return Dd(this,void 0,void 0,function*(){let t=f2.default.join(this.tempPath,"hook");if(!Sf.default.existsSync(t))return;let{logger:r}=this.options,{parameters:n,access:u}=this.options,i=yield require(t),o={provider:this.provider,name:this.name,version:this.version,appPath:this.filePath,tempAppPath:this.tempPath,logger:r,fs:Sf.default,lodash:ar(),artTemplate:s=>{this.doArtTemplate(f2.default.join(this.filePath,s))}};try{return yield i.postInit(o)}catch(s){r.debug(s)}})}parsePublishYaml(){return Dd(this,void 0,void 0,function*(){let t=f2.default.join(this.tempPath,"publish.yaml");if(!Sf.default.existsSync(t))throw new Error("publish.yaml is not found");Sf.default.emptyDirSync(this.filePath),Sf.default.copySync(f2.default.join(this.tempPath,"src"),this.filePath);let r=(0,yee.getYamlPath)(f2.default.join(this.filePath,"s.yaml"));if((0,Au.isEmpty)(r))return;this.spath=r;let{parameters:n={}}=this.options;if(!(0,Au.isEmpty)(n)||(0,yee.isCiCdEnvironment)()){let u=this.parsePublishWithParameters(t);this.publishData=Object.assign(Object.assign({},u),{access:this.options.access});return}this.options.y||(this.publishData=yield this.parsePublishWithInquire(t))})}parsePublishWithInquire(t){return Dd(this,void 0,void 0,function*(){let r=(0,yee.getYamlContent)(t),n=(0,Au.get)(r,"Parameters.properties"),u=(0,Au.get)(r,"Parameters.required"),i=[];if(n){let a=[];for(let c in n){let l=n[c];l.__key=c,a.push(l)}a=(0,Au.sortBy)(a,c=>c["x-range"]);for(let c of a){let l=c.__key,f=c.description?`${(0,CSn.gray)(c.description)}
583
+ ${n}=${this.publishData[n]}`).join("");Sf.default.appendFileSync(t,r,"utf-8")}Sf.default.removeSync(this.tempPath)})}parseAppName(t){if((0,Au.isEmpty)(this.spath))return;let r=t||Sf.default.readFileSync(this.spath,"utf-8"),{appName:n}=this.options;if((0,Au.isEmpty)(n))return;let u=(0,ESn.default)({appName:n},r);Sf.default.writeFileSync(this.spath,u,"utf-8")}parseTemplateYaml(t){return Dd(this,void 0,void 0,function*(){if(!(0,Au.isEmpty)(this.publishData))return this.publishData=Object.assign(Object.assign({},this.publishData),t),this.doArtTemplate(this.spath)})}doArtTemplate(t){Dee.default.defaults.extname=f2.default.extname(t),(0,Au.set)(Dee.default.defaults,"escape",!1);let r=f2.default.join(this.tempPath,"hook","filter.js");if(Sf.default.existsSync(r)){let u=require(r);for(let i in u)Dee.default.defaults.imports[i]=u[i]}let n=(0,Dee.default)(t,this.publishData);return Sf.default.writeFileSync(t,n,"utf-8"),n}postInit(){return Dd(this,void 0,void 0,function*(){let t=f2.default.join(this.tempPath,"hook");if(!Sf.default.existsSync(t))return;let{logger:r}=this.options,{parameters:n,access:u}=this.options,i=yield require(t),o={provider:this.provider,name:this.name,version:this.version,appPath:this.filePath,tempAppPath:this.tempPath,logger:r,fs:Sf.default,lodash:ar(),artTemplate:s=>{this.doArtTemplate(f2.default.join(this.filePath,s))}};try{return yield i.postInit(o)}catch(s){r.debug(s)}})}parsePublishYaml(){return Dd(this,void 0,void 0,function*(){let t=f2.default.join(this.tempPath,"publish.yaml");if(!Sf.default.existsSync(t))throw new Error("publish.yaml is not found");this.options.overwrite!==!1&&Sf.default.emptyDirSync(this.filePath),Sf.default.copySync(f2.default.join(this.tempPath,"src"),this.filePath);let r=(0,yee.getYamlPath)(f2.default.join(this.filePath,"s.yaml"));if((0,Au.isEmpty)(r))return;this.spath=r;let{parameters:n={}}=this.options;if(!(0,Au.isEmpty)(n)||(0,yee.isCiCdEnvironment)()){let u=this.parsePublishWithParameters(t);this.publishData=Object.assign(Object.assign({},u),{access:this.options.access});return}this.options.y||(this.publishData=yield this.parsePublishWithInquire(t))})}parsePublishWithInquire(t){return Dd(this,void 0,void 0,function*(){let r=(0,yee.getYamlContent)(t),n=(0,Au.get)(r,"Parameters.properties"),u=(0,Au.get)(r,"Parameters.required"),i=[];if(n){let a=[];for(let c in n){let l=n[c];l.__key=c,a.push(l)}a=(0,Au.sortBy)(a,c=>c["x-range"]);for(let c of a){let l=c.__key,f=c.description?`${(0,CSn.gray)(c.description)}
584
584
  ${bSn.default.green("?")}`:void 0,p=h=>(0,Au.isEmpty)(h)?(0,Au.includes)(u,l)?"value cannot be empty.":!0:c.pattern?new RegExp(c.pattern).test(h)?!0:c.description:!0;c.type==="boolean"?i.push({type:"confirm",name:l,prefix:f,message:c.title,default:c.default}):c.type==="secret"?(this.secretList.push(l),i.push({type:"password",name:l,prefix:f,message:c.title,default:c.default,validate:p})):c.enum?i.push({type:"list",name:l,prefix:f,message:c.title,choices:c.enum,default:c.default}):c.type==="string"&&i.push({type:"input",message:c.title,name:l,prefix:f,default:(0,iAe.getDefaultValue)(c.default),validate:p})}}let o=(0,Au.map)(yield(0,iAe.getAllCredential)({logger:this.options.logger}),a=>({name:a,value:a})),s={};if(this.options.access)s=yield oAe.default.prompt(i),s.access=yield this.getCredentialDirectly();else if((0,Au.isEmpty)(o))if(i.push({type:"confirm",name:"__access",message:"create credential?",default:!0}),s=yield oAe.default.prompt(i),(0,Au.get)(s,"__access")){let a=yield new ZPt.default({logger:this.options.logger}).set();s.access=a==null?void 0:a.access}else s.access=Pg.DEFAULT_MAGIC_ACCESS;else i.push({type:"list",name:"access",message:"please select credential alias",choices:(0,Au.concat)(o,{name:"configure later.",value:Pg.CONFIGURE_LATER})}),s=yield oAe.default.prompt(i),s.access===Pg.CONFIGURE_LATER&&(s.access=Pg.DEFAULT_MAGIC_ACCESS);return s})}getCredentialDirectly(){return Dd(this,void 0,void 0,function*(){let{logger:t}=this.options,r=new ZPt.default({logger:this.options.logger});try{let n=yield r.get(this.options.access);return n==null?void 0:n.access}catch(n){let u=n;t.tips(u.message);let i=yield r.set();return i==null?void 0:i.access}})}parsePublishWithParameters(t){let r=(0,yee.getYamlContent)(t),n=(0,Au.get)(r,"Parameters.properties",{}),u=(0,Au.get)(r,"Parameters.required",[]),{parameters:i={}}=this.options,o={};for(let s in n){let a=n[s];if((0,Au.has)(i,s))(0,Au.set)(o,s,i[s]);else if(a.hasOwnProperty("default"))(0,Au.set)(o,s,(0,iAe.getDefaultValue)(a.default));else if((0,Au.includes)(u,s))throw new Error(`parameter ${s} is required`)}return o}preInit(){return Dd(this,void 0,void 0,function*(){let t=f2.default.join(this.tempPath,"hook");if(!Sf.default.existsSync(t))return;let{logger:r}=this.options,n=yield require(t),u={provider:this.provider,name:this.name,version:this.version,appPath:this.filePath,tempAppPath:this.tempPath,logger:r,fs:Sf.default,lodash:ar()};try{yield n.preInit(u)}catch(i){r.debug(i)}})}doLoad(){return Dd(this,void 0,void 0,function*(){let{logger:t}=this.options,r=this.version?yield this.doZipballUrlWithVersion():yield this.doZipballUrl();yield(0,ySn.default)(r,{dest:this.tempPath,logger:t,extract:!0,strip:1,filename:this.name})})}doZipballUrl(){return Dd(this,void 0,void 0,function*(){let r={[Yx.IProvider.PERSONAL]:`${Pg.REGISTRY.V2}/${this.name}/releases/latest`,[Yx.IProvider.DEVSAPP]:`${Pg.REGISTRY.V2}/${this.provider}/${this.name}/releases/latest`}[this.provider];Eee(`url: ${r}`);let n=yield QPt.default.get(r);Eee(`res: ${JSON.stringify(n.data)}`);let u=(0,Au.get)(n,"data.Response.zipball_url");if((0,Au.isEmpty)(u))throw new Error(`Application ${this.name} is not found`);return u})}doZipballUrlWithVersion(){return Dd(this,void 0,void 0,function*(){let r={[Yx.IProvider.PERSONAL]:`${Pg.REGISTRY.V2}/${this.name}/releases`,[Yx.IProvider.DEVSAPP]:`${Pg.REGISTRY.V2}/${this.provider}/${this.name}/releases`}[this.provider];Eee(`url: ${r}`);let n=yield QPt.default.get(r);Eee(`res: ${JSON.stringify(n.data)}`);let u=(0,Au.find)((0,Au.get)(n,"data.Response"),i=>i.tag_name===this.version);if((0,Au.isEmpty)(u))throw new Error(`Application ${this.name}@${this.version} is not found`);return u.zipball_url})}};S5.default=sAe});var nkt=L(PE=>{"use strict";var aAe=PE&&PE.__awaiter||function(e,t,r,n){function u(i){return i instanceof r?i:new r(function(o){o(i)})}return new(r||(r=Promise))(function(i,o){function s(l){try{c(n.next(l))}catch(f){o(f)}}function a(l){try{c(n.throw(l))}catch(f){o(f)}}function c(l){l.done?i(l.value):u(l.value).then(s,a)}c((n=n.apply(e,t||[])).next())})},cAe=PE&&PE.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(PE,"__esModule",{value:!0});var ASn=cAe(XPt()),FSn=cAe(ekt()),_Sn=cAe(require("assert")),BSn=ar(),Xx=ed()("serverless-devs:load-appliaction");PE.default=(e,t={})=>aAe(void 0,void 0,void 0,function*(){if(Xx(`load application, template: ${e}, options: ${JSON.stringify(t)}`),t.uri)return yield rkt(e,t);if((0,_Sn.default)(e,"template is required"),(0,BSn.includes)(e,"/"))return yield tkt(e,t);try{return yield rkt(e,t)}catch(r){return Xx(`v3 error, ${r}`),yield tkt(e,t)}});var tkt=(e,t={})=>aAe(void 0,void 0,void 0,function*(){Xx("try to load v2");let r=yield new FSn.default(e,t).run();return Xx("load v2 success"),r}),rkt=(e,t={})=>aAe(void 0,void 0,void 0,function*(){Xx("try to load v3");let r=yield new ASn.default(e,t).run();return Xx("load v3 success"),r})});var Uo,Aee,bee,Fee,lAe,Cee,ukt,fAe,xee,ikt,okt,pR,skt=wt(()=>{Uo=ot(ar()),Aee=[{name:"Alibaba Cloud Serverless",value:"Alibaba_Cloud_Serverless"},{name:"AWS Cloud Serverless",value:"devscomp/start-lambda"},{name:"Tencent Cloud Serverless",value:"devscomp/start-scf"},{name:"Huawei Cloud Serverless",value:"Huawei_Cloud_Serverless"},{name:"Baidu Cloud Serverless",value:"Baidu_Cloud_Serverless"},{name:"Dev Template for Serverless Devs",value:"Dev_Template_for_Serverless_Devs"}],bee=[{name:"Application Scaffolding",value:"start-application-v3"},{name:"Component Scaffolding",value:"start-component-v3"},{name:"Plugin Scaffolding",value:"start-plugin-v3"}],Fee={ali_template:[{name:"Quick start [Deploy a Hello World function to FaaS]",value:"quick_start"},{name:"Custom runtime example [Deploy function to FaaS with custom runtime]",value:"custom_runtime"},{name:"Container example [Deploy function to FaaS with custom-container]",value:"container_example"},{name:"Custom domain example [Deploy function to FaaS with custom domain]",value:"custom_domain"}],contents:{quick_start:[{name:"Node.js",value:"start-fc3-nodejs"},{name:"Python3",value:"start-fc3-python"},{name:"Java",value:"start-fc3-java"},{name:"Go",value:"start-fc3-golang"},{name:"Dotnet",value:"start-fc3-dotnetcore"}],custom_runtime:[{name:"Node.js",value:"start-fc3-custom-nodejs"},{name:"Python3",value:"start-fc3-custom-python"},{name:"Java",value:"start-fc3-custom-java"},{name:"Go",value:"start-fc3-custom-golang"}],container_example:[{name:"Node.js",value:"start-fc3-custom-container-nodejs"},{name:"Python3",value:"start-fc3-custom-container-python"},{name:"Java",value:"start-fc3-custom-container-java"},{name:"Go",value:"start-fc3-custom-container-golang"}],custom_domain:[{name:"default",value:"fc-custom-domain"}]},version:"0.0.5"},lAe=[{name:"Quick start [Deploy a Hello World function to FaaS]",value:"quick_start"}],Cee=[{name:"[HTTP] Node.js 14",value:"start-fg-http-nodejs14"},{name:"[HTTP] Python3",value:"start-fg-http-python3"},{name:"[Event] Node.js 14",value:"start-fg-event-nodejs14"},{name:"[Event] Python3",value:"start-fg-event-python3"}],ukt=(0,Uo.concat)(lAe,Cee),fAe=[{name:"Quick start [Deploy a Hello World function to FaaS]",value:"quick_start"}],xee=[{name:"[HTTP] Node.js 12",value:"start-cfc-http-nodejs12"},{name:"[HTTP] Python 3",value:"start-cfc-http-python3"}],ikt=(0,Uo.concat)(fAe,xee),okt=(0,Uo.concat)(Aee,ukt,ikt,bee),pR=[{type:"autocomplete",name:"template",message:"Which template do you like?",default:(0,Uo.first)(bee).value,loop:!0,when(e){return e.firstLevel==="Dev_Template_for_Serverless_Devs"},source:async function(e,t){return t?bee.filter(r=>(0,Uo.lowerCase)(r.name).includes((0,Uo.lowerCase)(t))):bee}},{type:"autocomplete",name:"huawei_template",when(e){return e.firstLevel==="Huawei_Cloud_Serverless"},default:(0,Uo.first)(lAe).value,message:"Hello, serverlesser. Which template do you like?",source:async function(e,t){return t?ukt.filter(r=>(0,Uo.lowerCase)(r.name).includes((0,Uo.lowerCase)(t))):lAe}},{type:"autocomplete",name:"template",loop:!0,when(e){return e.huawei_template==="quick_start"},message:"Which template do you like?",default:(0,Uo.first)(Cee).value,source:async function(e,t){return t?Cee.filter(r=>(0,Uo.lowerCase)(r.name).includes((0,Uo.lowerCase)(t))):Cee}},{type:"autocomplete",name:"baidu_template",when(e){return e.firstLevel==="Baidu_Cloud_Serverless"},default:(0,Uo.first)(fAe).value,message:"Hello, serverlesser. Which template do you like?",source:async function(e,t){return t?ikt.filter(r=>(0,Uo.lowerCase)(r.name).includes((0,Uo.lowerCase)(t))):fAe}},{type:"autocomplete",name:"template",loop:!0,when(e){return e.baidu_template==="quick_start"},message:"Which template do you like?",default:(0,Uo.first)(xee).value,source:async function(e,t){return t?xee.filter(r=>(0,Uo.lowerCase)(r.name).includes((0,Uo.lowerCase)(t))):xee}}]});var Jx=wt(()=>{});function hR(e,t){return function(){return e.apply(t,arguments)}}var pAe=wt(()=>{"use strict"});function SSn(e){return e!==null&&!dR(e)&&e.constructor!==null&&!dR(e.constructor)&&$p(e.constructor.isBuffer)&&e.constructor.isBuffer(e)}function OSn(e){let t;return typeof ArrayBuffer<"u"&&ArrayBuffer.isView?t=ArrayBuffer.isView(e):t=e&&e.buffer&&lkt(e.buffer),t}function mR(e,t,{allOwnKeys:r=!1}={}){if(e===null||typeof e>"u")return;let n,u;if(typeof e!="object"&&(e=[e]),Qx(e))for(n=0,u=e.length;n<u;n++)t.call(null,e[n],n,e);else{let i=r?Object.getOwnPropertyNames(e):Object.keys(e),o=i.length,s;for(n=0;n<o;n++)s=i[n],t.call(null,e[s],s,e)}}function pkt(e,t){t=t.toLowerCase();let r=Object.keys(e),n=r.length,u;for(;n-- >0;)if(u=r[n],t===u.toLowerCase())return u;return null}function dAe(){let{caseless:e}=dkt(this)&&this||{},t={},r=(n,u)=>{let i=e&&pkt(t,u)||u;_ee(t[i])&&_ee(n)?t[i]=dAe(t[i],n):_ee(n)?t[i]=dAe({},n):Qx(n)?t[i]=n.slice():t[i]=n};for(let n=0,u=arguments.length;n<u;n++)arguments[n]&&mR(arguments[n],r);return t}function uOn(e){return!!(e&&$p(e.append)&&e[Symbol.toStringTag]==="FormData"&&e[Symbol.iterator])}var wSn,mAe,Bee,h2,wee,Qx,dR,lkt,TSn,$p,fkt,See,PSn,_ee,kSn,RSn,ISn,jSn,LSn,NSn,qSn,MSn,hkt,dkt,USn,$Sn,zSn,WSn,GSn,VSn,HSn,KSn,YSn,XSn,JSn,akt,QSn,mkt,ZSn,eOn,tOn,rOn,hAe,ckt,gkt,nOn,iOn,oOn,sOn,Ct,$i=wt(()=>{"use strict";pAe();({toString:wSn}=Object.prototype),{getPrototypeOf:mAe}=Object,Bee=(e=>t=>{let r=wSn.call(t);return e[r]||(e[r]=r.slice(8,-1).toLowerCase())})(Object.create(null)),h2=e=>(e=e.toLowerCase(),t=>Bee(t)===e),wee=e=>t=>typeof t===e,{isArray:Qx}=Array,dR=wee("undefined");lkt=h2("ArrayBuffer");TSn=wee("string"),$p=wee("function"),fkt=wee("number"),See=e=>e!==null&&typeof e=="object",PSn=e=>e===!0||e===!1,_ee=e=>{if(Bee(e)!=="object")return!1;let t=mAe(e);return(t===null||t===Object.prototype||Object.getPrototypeOf(t)===null)&&!(Symbol.toStringTag in e)&&!(Symbol.iterator in e)},kSn=h2("Date"),RSn=h2("File"),ISn=h2("Blob"),jSn=h2("FileList"),LSn=e=>See(e)&&$p(e.pipe),NSn=e=>{let t;return e&&(typeof FormData=="function"&&e instanceof FormData||$p(e.append)&&((t=Bee(e))==="formdata"||t==="object"&&$p(e.toString)&&e.toString()==="[object FormData]"))},qSn=h2("URLSearchParams"),MSn=e=>e.trim?e.trim():e.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,"");hkt=(()=>typeof globalThis<"u"?globalThis:typeof self<"u"?self:typeof window<"u"?window:global)(),dkt=e=>!dR(e)&&e!==hkt;USn=(e,t,r,{allOwnKeys:n}={})=>(mR(t,(u,i)=>{r&&$p(u)?e[i]=hR(u,r):e[i]=u},{allOwnKeys:n}),e),$Sn=e=>(e.charCodeAt(0)===65279&&(e=e.slice(1)),e),zSn=(e,t,r,n)=>{e.prototype=Object.create(t.prototype,n),e.prototype.constructor=e,Object.defineProperty(e,"super",{value:t.prototype}),r&&Object.assign(e.prototype,r)},WSn=(e,t,r,n)=>{let u,i,o,s={};if(t=t||{},e==null)return t;do{for(u=Object.getOwnPropertyNames(e),i=u.length;i-- >0;)o=u[i],(!n||n(o,e,t))&&!s[o]&&(t[o]=e[o],s[o]=!0);e=r!==!1&&mAe(e)}while(e&&(!r||r(e,t))&&e!==Object.prototype);return t},GSn=(e,t,r)=>{e=String(e),(r===void 0||r>e.length)&&(r=e.length),r-=t.length;let n=e.indexOf(t,r);return n!==-1&&n===r},VSn=e=>{if(!e)return null;if(Qx(e))return e;let t=e.length;if(!fkt(t))return null;let r=new Array(t);for(;t-- >0;)r[t]=e[t];return r},HSn=(e=>t=>e&&t instanceof e)(typeof Uint8Array<"u"&&mAe(Uint8Array)),KSn=(e,t)=>{let n=(e&&e[Symbol.iterator]).call(e),u;for(;(u=n.next())&&!u.done;){let i=u.value;t.call(e,i[0],i[1])}},YSn=(e,t)=>{let r,n=[];for(;(r=e.exec(t))!==null;)n.push(r);return n},XSn=h2("HTMLFormElement"),JSn=e=>e.toLowerCase().replace(/[-_\s]([a-z\d])(\w*)/g,function(r,n,u){return n.toUpperCase()+u}),akt=(({hasOwnProperty:e})=>(t,r)=>e.call(t,r))(Object.prototype),QSn=h2("RegExp"),mkt=(e,t)=>{let r=Object.getOwnPropertyDescriptors(e),n={};mR(r,(u,i)=>{let o;(o=t(u,i,e))!==!1&&(n[i]=o||u)}),Object.defineProperties(e,n)},ZSn=e=>{mkt(e,(t,r)=>{if($p(e)&&["arguments","caller","callee"].indexOf(r)!==-1)return!1;let n=e[r];if($p(n)){if(t.enumerable=!1,"writable"in t){t.writable=!1;return}t.set||(t.set=()=>{throw Error("Can not rewrite read-only method '"+r+"'")})}})},eOn=(e,t)=>{let r={},n=u=>{u.forEach(i=>{r[i]=!0})};return Qx(e)?n(e):n(String(e).split(t)),r},tOn=()=>{},rOn=(e,t)=>(e=+e,Number.isFinite(e)?e:t),hAe="abcdefghijklmnopqrstuvwxyz",ckt="0123456789",gkt={DIGIT:ckt,ALPHA:hAe,ALPHA_DIGIT:hAe+hAe.toUpperCase()+ckt},nOn=(e=16,t=gkt.ALPHA_DIGIT)=>{let r="",{length:n}=t;for(;e--;)r+=t[Math.random()*n|0];return r};iOn=e=>{let t=new Array(10),r=(n,u)=>{if(See(n)){if(t.indexOf(n)>=0)return;if(!("toJSON"in n)){t[u]=n;let i=Qx(n)?[]:{};return mR(n,(o,s)=>{let a=r(o,u+1);!dR(a)&&(i[s]=a)}),t[u]=void 0,i}}return n};return r(e,0)},oOn=h2("AsyncFunction"),sOn=e=>e&&(See(e)||$p(e))&&$p(e.then)&&$p(e.catch),Ct={isArray:Qx,isArrayBuffer:lkt,isBuffer:SSn,isFormData:NSn,isArrayBufferView:OSn,isString:TSn,isNumber:fkt,isBoolean:PSn,isObject:See,isPlainObject:_ee,isUndefined:dR,isDate:kSn,isFile:RSn,isBlob:ISn,isRegExp:QSn,isFunction:$p,isStream:LSn,isURLSearchParams:qSn,isTypedArray:HSn,isFileList:jSn,forEach:mR,merge:dAe,extend:USn,trim:MSn,stripBOM:$Sn,inherits:zSn,toFlatObject:WSn,kindOf:Bee,kindOfTest:h2,endsWith:GSn,toArray:VSn,forEachEntry:KSn,matchAll:YSn,isHTMLForm:XSn,hasOwnProperty:akt,hasOwnProp:akt,reduceDescriptors:mkt,freezeMethods:ZSn,toObjectSet:eOn,toCamelCase:JSn,noop:tOn,toFiniteNumber:rOn,findKey:pkt,global:hkt,isContextDefined:dkt,ALPHABET:gkt,generateString:nOn,isSpecCompliantForm:uOn,toJSONObject:iOn,isAsyncFn:oOn,isThenable:sOn}});function Zx(e,t,r,n,u){Error.call(this),Error.captureStackTrace?Error.captureStackTrace(this,this.constructor):this.stack=new Error().stack,this.message=e,this.name="AxiosError",t&&(this.code=t),r&&(this.config=r),n&&(this.request=n),u&&(this.response=u)}var vkt,Dkt,pr,yd=wt(()=>{"use strict";$i();Ct.inherits(Zx,Error,{toJSON:function(){return{message:this.message,name:this.name,description:this.description,number:this.number,fileName:this.fileName,lineNumber:this.lineNumber,columnNumber:this.columnNumber,stack:this.stack,config:Ct.toJSONObject(this.config),code:this.code,status:this.response&&this.response.status?this.response.status:null}}});vkt=Zx.prototype,Dkt={};["ERR_BAD_OPTION_VALUE","ERR_BAD_OPTION","ECONNABORTED","ETIMEDOUT","ERR_NETWORK","ERR_FR_TOO_MANY_REDIRECTS","ERR_DEPRECATED","ERR_BAD_RESPONSE","ERR_BAD_REQUEST","ERR_CANCELED","ERR_NOT_SUPPORT","ERR_INVALID_URL"].forEach(e=>{Dkt[e]={value:e}});Object.defineProperties(Zx,Dkt);Object.defineProperty(vkt,"isAxiosError",{value:!0});Zx.from=(e,t,r,n,u,i)=>{let o=Object.create(vkt);return Ct.toFlatObject(e,o,function(a){return a!==Error.prototype},s=>s!=="isAxiosError"),Zx.call(o,e.message,t,r,n,u),o.cause=e,o.name=e.name,i&&Object.assign(o,i),o};pr=Zx});var ykt,Oee,gAe=wt(()=>{ykt=ot(O3e(),1),Oee=ykt.default});function vAe(e){return Ct.isPlainObject(e)||Ct.isArray(e)}function bkt(e){return Ct.endsWith(e,"[]")?e.slice(0,-2):e}function Ekt(e,t,r){return e?e.concat(t).map(function(u,i){return u=bkt(u),!r&&i?"["+u+"]":u}).join(r?".":""):t}function aOn(e){return Ct.isArray(e)&&!e.some(vAe)}function lOn(e,t,r){if(!Ct.isObject(e))throw new TypeError("target must be an object");t=t||new(Oee||FormData),r=Ct.toFlatObject(r,{metaTokens:!0,dots:!1,indexes:!1},!1,function(m,v){return!Ct.isUndefined(v[m])});let n=r.metaTokens,u=r.visitor||l,i=r.dots,o=r.indexes,a=(r.Blob||typeof Blob<"u"&&Blob)&&Ct.isSpecCompliantForm(t);if(!Ct.isFunction(u))throw new TypeError("visitor must be a function");function c(d){if(d===null)return"";if(Ct.isDate(d))return d.toISOString();if(!a&&Ct.isBlob(d))throw new pr("Blob is not supported. Use a Buffer instead.");return Ct.isArrayBuffer(d)||Ct.isTypedArray(d)?a&&typeof Blob=="function"?new Blob([d]):Buffer.from(d):d}function l(d,m,v){let y=d;if(d&&!v&&typeof d=="object"){if(Ct.endsWith(m,"{}"))m=n?m:m.slice(0,-2),d=JSON.stringify(d);else if(Ct.isArray(d)&&aOn(d)||(Ct.isFileList(d)||Ct.endsWith(m,"[]"))&&(y=Ct.toArray(d)))return m=bkt(m),y.forEach(function(D,E){!(Ct.isUndefined(D)||D===null)&&t.append(o===!0?Ekt([m],E,i):o===null?m:m+"[]",c(D))}),!1}return vAe(d)?!0:(t.append(Ekt(v,m,i),c(d)),!1)}let f=[],p=Object.assign(cOn,{defaultVisitor:l,convertValue:c,isVisitable:vAe});function h(d,m){if(!Ct.isUndefined(d)){if(f.indexOf(d)!==-1)throw Error("Circular reference detected in "+m.join("."));f.push(d),Ct.forEach(d,function(y,g){(!(Ct.isUndefined(y)||y===null)&&u.call(t,y,Ct.isString(g)?g.trim():g,m,p))===!0&&h(y,m?m.concat(g):[g])}),f.pop()}}if(!Ct.isObject(e))throw new TypeError("data must be an object");return h(e),t}var cOn,kg,gR=wt(()=>{"use strict";$i();yd();gAe();cOn=Ct.toFlatObject(Ct,{},null,function(t){return/^is[A-Z]/.test(t)});kg=lOn});function Ckt(e){let t={"!":"%21","'":"%27","(":"%28",")":"%29","~":"%7E","%20":"+","%00":"\0"};return encodeURIComponent(e).replace(/[!'()~]|%20|%00/g,function(n){return t[n]})}function xkt(e,t){this._pairs=[],e&&kg(e,this,t)}var Akt,Fkt,_kt=wt(()=>{"use strict";gR();Akt=xkt.prototype;Akt.append=function(t,r){this._pairs.push([t,r])};Akt.toString=function(t){let r=t?function(n){return t.call(this,n,Ckt)}:Ckt;return this._pairs.map(function(u){return r(u[0])+"="+r(u[1])},"").join("&")};Fkt=xkt});function fOn(e){return encodeURIComponent(e).replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%20/g,"+").replace(/%5B/gi,"[").replace(/%5D/gi,"]")}function kE(e,t,r){if(!t)return e;let n=r&&r.encode||fOn,u=r&&r.serialize,i;if(u?i=u(t,r):i=Ct.isURLSearchParams(t)?t.toString():new Fkt(t,r).toString(n),i){let o=e.indexOf("#");o!==-1&&(e=e.slice(0,o)),e+=(e.indexOf("?")===-1?"?":"&")+i}return e}var Tee=wt(()=>{"use strict";$i();_kt()});var DAe,yAe,Bkt=wt(()=>{"use strict";$i();DAe=class{constructor(){this.handlers=[]}use(t,r,n){return this.handlers.push({fulfilled:t,rejected:r,synchronous:n?n.synchronous:!1,runWhen:n?n.runWhen:null}),this.handlers.length-1}eject(t){this.handlers[t]&&(this.handlers[t]=null)}clear(){this.handlers&&(this.handlers=[])}forEach(t){Ct.forEach(this.handlers,function(n){n!==null&&t(n)})}},yAe=DAe});var eA,Pee=wt(()=>{"use strict";eA={silentJSONParsing:!0,forcedJSONParsing:!0,clarifyTimeoutError:!1}});var wkt,Skt,Okt=wt(()=>{"use strict";wkt=ot(require("url"),1),Skt=wkt.default.URLSearchParams});var Tkt,Pkt=wt(()=>{Okt();gAe();Tkt={isNode:!0,classes:{URLSearchParams:Skt,FormData:Oee,Blob:typeof Blob<"u"&&Blob||null},protocols:["http","https","file","data"]}});var EAe={};Fir(EAe,{hasBrowserEnv:()=>kkt,hasStandardBrowserEnv:()=>pOn,hasStandardBrowserWebWorkerEnv:()=>hOn});var kkt,pOn,hOn,Rkt=wt(()=>{kkt=typeof window<"u"&&typeof document<"u",pOn=(e=>kkt&&["ReactNative","NativeScript","NS"].indexOf(e)<0)(typeof navigator<"u"&&navigator.product),hOn=(()=>typeof WorkerGlobalScope<"u"&&self instanceof WorkerGlobalScope&&typeof self.importScripts=="function")()});var Rs,Rg=wt(()=>{Pkt();Rkt();Rs={...EAe,...Tkt}});function bAe(e,t){return kg(e,new Rs.classes.URLSearchParams,Object.assign({visitor:function(r,n,u,i){return Rs.isNode&&Ct.isBuffer(r)?(this.append(n,r.toString("base64")),!1):i.defaultVisitor.apply(this,arguments)}},t))}var Ikt=wt(()=>{"use strict";$i();gR();Rg()});function dOn(e){return Ct.matchAll(/\w+|\[(\w*)]/g,e).map(t=>t[0]==="[]"?"":t[1]||t[0])}function mOn(e){let t={},r=Object.keys(e),n,u=r.length,i;for(n=0;n<u;n++)i=r[n],t[i]=e[i];return t}function gOn(e){function t(r,n,u,i){let o=r[i++],s=Number.isFinite(+o),a=i>=r.length;return o=!o&&Ct.isArray(u)?u.length:o,a?(Ct.hasOwnProp(u,o)?u[o]=[u[o],n]:u[o]=n,!s):((!u[o]||!Ct.isObject(u[o]))&&(u[o]=[]),t(r,n,u[o],i)&&Ct.isArray(u[o])&&(u[o]=mOn(u[o])),!s)}if(Ct.isFormData(e)&&Ct.isFunction(e.entries)){let r={};return Ct.forEachEntry(e,(n,u)=>{t(dOn(n),u,r,0)}),r}return null}var kee,CAe=wt(()=>{"use strict";$i();kee=gOn});function vOn(e,t,r){if(Ct.isString(e))try{return(t||JSON.parse)(e),Ct.trim(e)}catch(n){if(n.name!=="SyntaxError")throw n}return(r||JSON.stringify)(e)}var xAe,tA,Ree=wt(()=>{"use strict";$i();yd();Pee();gR();Ikt();Rg();CAe();xAe={transitional:eA,adapter:["xhr","http"],transformRequest:[function(t,r){let n=r.getContentType()||"",u=n.indexOf("application/json")>-1,i=Ct.isObject(t);if(i&&Ct.isHTMLForm(t)&&(t=new FormData(t)),Ct.isFormData(t))return u&&u?JSON.stringify(kee(t)):t;if(Ct.isArrayBuffer(t)||Ct.isBuffer(t)||Ct.isStream(t)||Ct.isFile(t)||Ct.isBlob(t))return t;if(Ct.isArrayBufferView(t))return t.buffer;if(Ct.isURLSearchParams(t))return r.setContentType("application/x-www-form-urlencoded;charset=utf-8",!1),t.toString();let s;if(i){if(n.indexOf("application/x-www-form-urlencoded")>-1)return bAe(t,this.formSerializer).toString();if((s=Ct.isFileList(t))||n.indexOf("multipart/form-data")>-1){let a=this.env&&this.env.FormData;return kg(s?{"files[]":t}:t,a&&new a,this.formSerializer)}}return i||u?(r.setContentType("application/json",!1),vOn(t)):t}],transformResponse:[function(t){let r=this.transitional||xAe.transitional,n=r&&r.forcedJSONParsing,u=this.responseType==="json";if(t&&Ct.isString(t)&&(n&&!this.responseType||u)){let o=!(r&&r.silentJSONParsing)&&u;try{return JSON.parse(t)}catch(s){if(o)throw s.name==="SyntaxError"?pr.from(s,pr.ERR_BAD_RESPONSE,this,null,this.response):s}}return t}],timeout:0,xsrfCookieName:"XSRF-TOKEN",xsrfHeaderName:"X-XSRF-TOKEN",maxContentLength:-1,maxBodyLength:-1,env:{FormData:Rs.classes.FormData,Blob:Rs.classes.Blob},validateStatus:function(t){return t>=200&&t<300},headers:{common:{Accept:"application/json, text/plain, */*","Content-Type":void 0}}};Ct.forEach(["delete","get","head","post","put","patch"],e=>{xAe.headers[e]={}});tA=xAe});var DOn,jkt,Lkt=wt(()=>{"use strict";$i();DOn=Ct.toObjectSet(["age","authorization","content-length","content-type","etag","expires","from","host","if-modified-since","if-unmodified-since","last-modified","location","max-forwards","proxy-authorization","referer","retry-after","user-agent"]),jkt=e=>{let t={},r,n,u;return e&&e.split(`
585
585
  `).forEach(function(o){u=o.indexOf(":"),r=o.substring(0,u).trim().toLowerCase(),n=o.substring(u+1).trim(),!(!r||t[r]&&DOn[r])&&(r==="set-cookie"?t[r]?t[r].push(n):t[r]=[n]:t[r]=t[r]?t[r]+", "+n:n)}),t}});function vR(e){return e&&String(e).trim().toLowerCase()}function Iee(e){return e===!1||e==null?e:Ct.isArray(e)?e.map(Iee):String(e)}function yOn(e){let t=Object.create(null),r=/([^\s,;=]+)\s*(?:=\s*([^,;]+))?/g,n;for(;n=r.exec(e);)t[n[1]]=n[2];return t}function AAe(e,t,r,n,u){if(Ct.isFunction(n))return n.call(this,t,r);if(u&&(t=r),!!Ct.isString(t)){if(Ct.isString(n))return t.indexOf(n)!==-1;if(Ct.isRegExp(n))return n.test(t)}}function bOn(e){return e.trim().toLowerCase().replace(/([a-z\d])(\w*)/g,(t,r,n)=>r.toUpperCase()+n)}function COn(e,t){let r=Ct.toCamelCase(" "+t);["get","set","has"].forEach(n=>{Object.defineProperty(e,n+r,{value:function(u,i,o){return this[n].call(this,t,u,i,o)},configurable:!0})})}var Nkt,EOn,rA,Is,Ig=wt(()=>{"use strict";$i();Lkt();Nkt=Symbol("internals");EOn=e=>/^[-_a-zA-Z0-9^`|~,!#$%&'*+.]+$/.test(e.trim());rA=class{constructor(t){t&&this.set(t)}set(t,r,n){let u=this;function i(s,a,c){let l=vR(a);if(!l)throw new Error("header name must be a non-empty string");let f=Ct.findKey(u,l);(!f||u[f]===void 0||c===!0||c===void 0&&u[f]!==!1)&&(u[f||a]=Iee(s))}let o=(s,a)=>Ct.forEach(s,(c,l)=>i(c,l,a));return Ct.isPlainObject(t)||t instanceof this.constructor?o(t,r):Ct.isString(t)&&(t=t.trim())&&!EOn(t)?o(jkt(t),r):t!=null&&i(r,t,n),this}get(t,r){if(t=vR(t),t){let n=Ct.findKey(this,t);if(n){let u=this[n];if(!r)return u;if(r===!0)return yOn(u);if(Ct.isFunction(r))return r.call(this,u,n);if(Ct.isRegExp(r))return r.exec(u);throw new TypeError("parser must be boolean|regexp|function")}}}has(t,r){if(t=vR(t),t){let n=Ct.findKey(this,t);return!!(n&&this[n]!==void 0&&(!r||AAe(this,this[n],n,r)))}return!1}delete(t,r){let n=this,u=!1;function i(o){if(o=vR(o),o){let s=Ct.findKey(n,o);s&&(!r||AAe(n,n[s],s,r))&&(delete n[s],u=!0)}}return Ct.isArray(t)?t.forEach(i):i(t),u}clear(t){let r=Object.keys(this),n=r.length,u=!1;for(;n--;){let i=r[n];(!t||AAe(this,this[i],i,t,!0))&&(delete this[i],u=!0)}return u}normalize(t){let r=this,n={};return Ct.forEach(this,(u,i)=>{let o=Ct.findKey(n,i);if(o){r[o]=Iee(u),delete r[i];return}let s=t?bOn(i):String(i).trim();s!==i&&delete r[i],r[s]=Iee(u),n[s]=!0}),this}concat(...t){return this.constructor.concat(this,...t)}toJSON(t){let r=Object.create(null);return Ct.forEach(this,(n,u)=>{n!=null&&n!==!1&&(r[u]=t&&Ct.isArray(n)?n.join(", "):n)}),r}[Symbol.iterator](){return Object.entries(this.toJSON())[Symbol.iterator]()}toString(){return Object.entries(this.toJSON()).map(([t,r])=>t+": "+r).join(`
586
586
  `)}get[Symbol.toStringTag](){return"AxiosHeaders"}static from(t){return t instanceof this?t:new this(t)}static concat(t,...r){let n=new this(t);return r.forEach(u=>n.set(u)),n}static accessor(t){let n=(this[Nkt]=this[Nkt]={accessors:{}}).accessors,u=this.prototype;function i(o){let s=vR(o);n[s]||(COn(u,o),n[s]=!0)}return Ct.isArray(t)?t.forEach(i):i(t),this}};rA.accessor(["Content-Type","Content-Length","Accept","Accept-Encoding","User-Agent","Authorization"]);Ct.reduceDescriptors(rA.prototype,({value:e},t)=>{let r=t[0].toUpperCase()+t.slice(1);return{get:()=>e,set(n){this[r]=n}}});Ct.freezeMethods(rA);Is=rA});function DR(e,t){let r=this||tA,n=t||r,u=Is.from(n.headers),i=n.data;return Ct.forEach(e,function(s){i=s.call(r,i,u.normalize(),t?t.status:void 0)}),u.normalize(),i}var qkt=wt(()=>{"use strict";$i();Ree();Ig()});function yR(e){return!!(e&&e.__CANCEL__)}var FAe=wt(()=>{"use strict"});function Mkt(e,t,r){pr.call(this,e==null?"canceled":e,pr.ERR_CANCELED,t,r),this.name="CanceledError"}var Ed,nA=wt(()=>{"use strict";yd();$i();Ct.inherits(Mkt,pr,{__CANCEL__:!0});Ed=Mkt});function jg(e,t,r){let n=r.config.validateStatus;!r.status||!n||n(r.status)?e(r):t(new pr("Request failed with status code "+r.status,[pr.ERR_BAD_REQUEST,pr.ERR_BAD_RESPONSE][Math.floor(r.status/100)-4],r.config,r.request,r))}var _Ae=wt(()=>{"use strict";yd()});function BAe(e){return/^([a-z][a-z\d+\-.]*:)?\/\//i.test(e)}var Ukt=wt(()=>{"use strict"});function wAe(e,t){return t?e.replace(/\/+$/,"")+"/"+t.replace(/^\/+/,""):e}var $kt=wt(()=>{"use strict"});function RE(e,t){return e&&!BAe(t)?wAe(e,t):t}var jee=wt(()=>{"use strict";Ukt();$kt()});var IE,Lee=wt(()=>{IE="1.6.2"});function ER(e){let t=/^([-+\w]{1,25})(:?\/\/|:)/.exec(e);return t&&t[1]||""}var SAe=wt(()=>{"use strict"});function OAe(e,t,r){let n=r&&r.Blob||Rs.classes.Blob,u=ER(e);if(t===void 0&&n&&(t=!0),u==="data"){e=u.length?e.slice(u.length+1):e;let i=xOn.exec(e);if(!i)throw new pr("Invalid URL",pr.ERR_INVALID_URL);let o=i[1],s=i[2],a=i[3],c=Buffer.from(decodeURIComponent(a),s?"base64":"utf8");if(t){if(!n)throw new pr("Blob is not supported",pr.ERR_NOT_SUPPORT);return new n([c],{type:o})}return c}throw new pr("Unsupported protocol "+u,pr.ERR_NOT_SUPPORT)}var xOn,zkt=wt(()=>{"use strict";yd();SAe();Rg();xOn=/^(?:([^;]+);)?(?:[^;]+;)?(base64|),([\s\S]*)$/});function AOn(e,t){let r=0,n=1e3/t,u=null;return function(o,s){let a=Date.now();if(o||a-r>n)return u&&(clearTimeout(u),u=null),r=a,e.apply(null,s);u||(u=setTimeout(()=>(u=null,r=Date.now(),e.apply(null,s)),n-(a-r)))}}var Wkt,Gkt=wt(()=>{"use strict";Wkt=AOn});function FOn(e,t){e=e||10;let r=new Array(e),n=new Array(e),u=0,i=0,o;return t=t!==void 0?t:1e3,function(a){let c=Date.now(),l=n[i];o||(o=c),r[u]=a,n[u]=c;let f=i,p=0;for(;f!==u;)p+=r[f++],f=f%e;if(u=(u+1)%e,u===i&&(i=(i+1)%e),c-o<t)return;let h=l&&c-l;return h?Math.round(p*1e3/h):void 0}}var Nee,TAe=wt(()=>{"use strict";Nee=FOn});var Vkt,qee,PAe,kAe,Hkt=wt(()=>{"use strict";Vkt=ot(require("stream"),1);$i();Gkt();TAe();qee=Symbol("internals"),PAe=class extends Vkt.default.Transform{constructor(t){t=Ct.toFlatObject(t,{maxRate:0,chunkSize:64*1024,minChunkSize:100,timeWindow:500,ticksRate:2,samplesCount:15},null,(s,a)=>!Ct.isUndefined(a[s])),super({readableHighWaterMark:t.chunkSize});let r=this,n=this[qee]={length:t.length,timeWindow:t.timeWindow,ticksRate:t.ticksRate,chunkSize:t.chunkSize,maxRate:t.maxRate,minChunkSize:t.minChunkSize,bytesSeen:0,isCaptured:!1,notifiedBytesLoaded:0,ts:Date.now(),bytes:0,onReadCallback:null},u=Nee(n.ticksRate*t.samplesCount,n.timeWindow);this.on("newListener",s=>{s==="progress"&&(n.isCaptured||(n.isCaptured=!0))});let i=0;n.updateProgress=Wkt(function(){let a=n.length,c=n.bytesSeen,l=c-i;if(!l||r.destroyed)return;let f=u(l);i=c,process.nextTick(()=>{r.emit("progress",{loaded:c,total:a,progress:a?c/a:void 0,bytes:l,rate:f||void 0,estimated:f&&a&&c<=a?(a-c)/f:void 0})})},n.ticksRate);let o=()=>{n.updateProgress(!0)};this.once("end",o),this.once("error",o)}_read(t){let r=this[qee];return r.onReadCallback&&r.onReadCallback(),super._read(t)}_transform(t,r,n){let u=this,i=this[qee],o=i.maxRate,s=this.readableHighWaterMark,a=i.timeWindow,c=1e3/a,l=o/c,f=i.minChunkSize!==!1?Math.max(i.minChunkSize,l*.01):0;function p(d,m){let v=Buffer.byteLength(d);i.bytesSeen+=v,i.bytes+=v,i.isCaptured&&i.updateProgress(),u.push(d)?process.nextTick(m):i.onReadCallback=()=>{i.onReadCallback=null,process.nextTick(m)}}let h=(d,m)=>{let v=Buffer.byteLength(d),y=null,g=s,D,E=0;if(o){let b=Date.now();(!i.ts||(E=b-i.ts)>=a)&&(i.ts=b,D=l-i.bytes,i.bytes=D<0?-D:0,E=0),D=l-i.bytes}if(o){if(D<=0)return setTimeout(()=>{m(null,d)},a-E);D<g&&(g=D)}g&&v>g&&v-g>f&&(y=d.subarray(g),d=d.subarray(0,g)),p(d,y?()=>{process.nextTick(m,null,y)}:m)};h(t,function d(m,v){if(m)return n(m);v?h(v,d):n(null)})}setLength(t){return this[qee].length=+t,this}},kAe=PAe});var Kkt,_On,Mee,RAe=wt(()=>{({asyncIterator:Kkt}=Symbol),_On=async function*(e){e.stream?yield*e.stream():e.arrayBuffer?yield await e.arrayBuffer():e[Kkt]?yield*e[Kkt]():yield e},Mee=_On});var Ykt,Xkt,BOn,bR,Lg,wOn,SOn,IAe,OOn,Jkt,Qkt=wt(()=>{Ykt=require("util"),Xkt=require("stream");$i();RAe();BOn=Ct.ALPHABET.ALPHA_DIGIT+"-_",bR=new Ykt.TextEncoder,Lg=`\r
@@ -589,7 +589,7 @@ ${bSn.default.green("?")}`:void 0,p=h=>(0,Au.isEmpty)(h)?(0,Au.includes)(u,l)?"v
589
589
  `):" "+ARt(i[0]):"as no adapter specified";throw new pr("There is no suitable adapter to dispatch the request "+o,"ERR_NOT_SUPPORT")}return n},adapters:LAe}});function qAe(e){if(e.cancelToken&&e.cancelToken.throwIfRequested(),e.signal&&e.signal.aborted)throw new Ed(null,e)}function $ee(e){return qAe(e),e.headers=Is.from(e.headers),e.data=DR.call(e,e.transformRequest),["post","put","patch"].indexOf(e.method)!==-1&&e.headers.setContentType("application/x-www-form-urlencoded",!1),Uee.getAdapter(e.adapter||tA.adapter)(e).then(function(n){return qAe(e),n.data=DR.call(e,e.transformResponse,n),n.headers=Is.from(n.headers),n},function(n){return yR(n)||(qAe(e),n&&n.response&&(n.response.data=DR.call(e,e.transformResponse,n.response),n.response.headers=Is.from(n.response.headers))),Promise.reject(n)})}var FRt=wt(()=>{"use strict";qkt();FAe();Ree();nA();Ig();NAe()});function T5(e,t){t=t||{};let r={};function n(c,l,f){return Ct.isPlainObject(c)&&Ct.isPlainObject(l)?Ct.merge.call({caseless:f},c,l):Ct.isPlainObject(l)?Ct.merge({},l):Ct.isArray(l)?l.slice():l}function u(c,l,f){if(Ct.isUndefined(l)){if(!Ct.isUndefined(c))return n(void 0,c,f)}else return n(c,l,f)}function i(c,l){if(!Ct.isUndefined(l))return n(void 0,l)}function o(c,l){if(Ct.isUndefined(l)){if(!Ct.isUndefined(c))return n(void 0,c)}else return n(void 0,l)}function s(c,l,f){if(f in t)return n(c,l);if(f in e)return n(void 0,c)}let a={url:i,method:i,data:i,baseURL:o,transformRequest:o,transformResponse:o,paramsSerializer:o,timeout:o,timeoutMessage:o,withCredentials:o,withXSRFToken:o,adapter:o,responseType:o,xsrfCookieName:o,xsrfHeaderName:o,onUploadProgress:o,onDownloadProgress:o,decompress:o,maxContentLength:o,maxBodyLength:o,beforeRedirect:o,transport:o,httpAgent:o,httpsAgent:o,cancelToken:o,socketPath:o,responseEncoding:o,validateStatus:s,headers:(c,l)=>u(_Rt(c),_Rt(l),!0)};return Ct.forEach(Object.keys(Object.assign({},e,t)),function(l){let f=a[l]||u,p=f(e[l],t[l],l);Ct.isUndefined(p)&&f!==s||(r[l]=p)}),r}var _Rt,MAe=wt(()=>{"use strict";$i();Ig();_Rt=e=>e instanceof Is?e.toJSON():e});function $On(e,t,r){if(typeof e!="object")throw new pr("options must be an object",pr.ERR_BAD_OPTION_VALUE);let n=Object.keys(e),u=n.length;for(;u-- >0;){let i=n[u],o=t[i];if(o){let s=e[i],a=s===void 0||o(s,i,e);if(a!==!0)throw new pr("option "+i+" must be "+a,pr.ERR_BAD_OPTION_VALUE);continue}if(r!==!0)throw new pr("Unknown option "+i,pr.ERR_BAD_OPTION)}}var UAe,BRt,zee,wRt=wt(()=>{"use strict";Lee();yd();UAe={};["object","boolean","number","function","string","symbol"].forEach((e,t)=>{UAe[e]=function(n){return typeof n===e||"a"+(t<1?"n ":" ")+e}});BRt={};UAe.transitional=function(t,r,n){function u(i,o){return"[Axios v"+IE+"] Transitional option '"+i+"'"+o+(n?". "+n:"")}return(i,o,s)=>{if(t===!1)throw new pr(u(o," has been removed"+(r?" in "+r:"")),pr.ERR_DEPRECATED);return r&&!BRt[o]&&(BRt[o]=!0,console.warn(u(o," has been deprecated since v"+r+" and will be removed in the near future"))),t?t(i,o,s):!0}};zee={assertOptions:$On,validators:UAe}});var Ng,uA,CR,SRt=wt(()=>{"use strict";$i();Tee();Bkt();FRt();MAe();jee();wRt();Ig();Ng=zee.validators,uA=class{constructor(t){this.defaults=t,this.interceptors={request:new yAe,response:new yAe}}request(t,r){typeof t=="string"?(r=r||{},r.url=t):r=t||{},r=T5(this.defaults,r);let{transitional:n,paramsSerializer:u,headers:i}=r;n!==void 0&&zee.assertOptions(n,{silentJSONParsing:Ng.transitional(Ng.boolean),forcedJSONParsing:Ng.transitional(Ng.boolean),clarifyTimeoutError:Ng.transitional(Ng.boolean)},!1),u!=null&&(Ct.isFunction(u)?r.paramsSerializer={serialize:u}:zee.assertOptions(u,{encode:Ng.function,serialize:Ng.function},!0)),r.method=(r.method||this.defaults.method||"get").toLowerCase();let o=i&&Ct.merge(i.common,i[r.method]);i&&Ct.forEach(["delete","get","head","post","put","patch","common"],d=>{delete i[d]}),r.headers=Is.concat(o,i);let s=[],a=!0;this.interceptors.request.forEach(function(m){typeof m.runWhen=="function"&&m.runWhen(r)===!1||(a=a&&m.synchronous,s.unshift(m.fulfilled,m.rejected))});let c=[];this.interceptors.response.forEach(function(m){c.push(m.fulfilled,m.rejected)});let l,f=0,p;if(!a){let d=[$ee.bind(this),void 0];for(d.unshift.apply(d,s),d.push.apply(d,c),p=d.length,l=Promise.resolve(r);f<p;)l=l.then(d[f++],d[f++]);return l}p=s.length;let h=r;for(f=0;f<p;){let d=s[f++],m=s[f++];try{h=d(h)}catch(v){m.call(this,v);break}}try{l=$ee.call(this,h)}catch(d){return Promise.reject(d)}for(f=0,p=c.length;f<p;)l=l.then(c[f++],c[f++]);return l}getUri(t){t=T5(this.defaults,t);let r=RE(t.baseURL,t.url);return kE(r,t.params,t.paramsSerializer)}};Ct.forEach(["delete","get","head","options"],function(t){uA.prototype[t]=function(r,n){return this.request(T5(n||{},{method:t,url:r,data:(n||{}).data}))}});Ct.forEach(["post","put","patch"],function(t){function r(n){return function(i,o,s){return this.request(T5(s||{},{method:t,headers:n?{"Content-Type":"multipart/form-data"}:{},url:i,data:o}))}}uA.prototype[t]=r(),uA.prototype[t+"Form"]=r(!0)});CR=uA});var $Ae,ORt,TRt=wt(()=>{"use strict";nA();$Ae=class e{constructor(t){if(typeof t!="function")throw new TypeError("executor must be a function.");let r;this.promise=new Promise(function(i){r=i});let n=this;this.promise.then(u=>{if(!n._listeners)return;let i=n._listeners.length;for(;i-- >0;)n._listeners[i](u);n._listeners=null}),this.promise.then=u=>{let i,o=new Promise(s=>{n.subscribe(s),i=s}).then(u);return o.cancel=function(){n.unsubscribe(i)},o},t(function(i,o,s){n.reason||(n.reason=new Ed(i,o,s),r(n.reason))})}throwIfRequested(){if(this.reason)throw this.reason}subscribe(t){if(this.reason){t(this.reason);return}this._listeners?this._listeners.push(t):this._listeners=[t]}unsubscribe(t){if(!this._listeners)return;let r=this._listeners.indexOf(t);r!==-1&&this._listeners.splice(r,1)}static source(){let t;return{token:new e(function(u){t=u}),cancel:t}}},ORt=$Ae});function zAe(e){return function(r){return e.apply(null,r)}}var PRt=wt(()=>{"use strict"});function WAe(e){return Ct.isObject(e)&&e.isAxiosError===!0}var kRt=wt(()=>{"use strict";$i()});var GAe,RRt,IRt=wt(()=>{GAe={Continue:100,SwitchingProtocols:101,Processing:102,EarlyHints:103,Ok:200,Created:201,Accepted:202,NonAuthoritativeInformation:203,NoContent:204,ResetContent:205,PartialContent:206,MultiStatus:207,AlreadyReported:208,ImUsed:226,MultipleChoices:300,MovedPermanently:301,Found:302,SeeOther:303,NotModified:304,UseProxy:305,Unused:306,TemporaryRedirect:307,PermanentRedirect:308,BadRequest:400,Unauthorized:401,PaymentRequired:402,Forbidden:403,NotFound:404,MethodNotAllowed:405,NotAcceptable:406,ProxyAuthenticationRequired:407,RequestTimeout:408,Conflict:409,Gone:410,LengthRequired:411,PreconditionFailed:412,PayloadTooLarge:413,UriTooLong:414,UnsupportedMediaType:415,RangeNotSatisfiable:416,ExpectationFailed:417,ImATeapot:418,MisdirectedRequest:421,UnprocessableEntity:422,Locked:423,FailedDependency:424,TooEarly:425,UpgradeRequired:426,PreconditionRequired:428,TooManyRequests:429,RequestHeaderFieldsTooLarge:431,UnavailableForLegalReasons:451,InternalServerError:500,NotImplemented:501,BadGateway:502,ServiceUnavailable:503,GatewayTimeout:504,HttpVersionNotSupported:505,VariantAlsoNegotiates:506,InsufficientStorage:507,LoopDetected:508,NotExtended:510,NetworkAuthenticationRequired:511};Object.entries(GAe).forEach(([e,t])=>{GAe[t]=e});RRt=GAe});function jRt(e){let t=new CR(e),r=hR(CR.prototype.request,t);return Ct.extend(r,CR.prototype,t,{allOwnKeys:!0}),Ct.extend(r,t,null,{allOwnKeys:!0}),r.create=function(u){return jRt(T5(e,u))},r}var ds,Wee,LRt=wt(()=>{"use strict";$i();pAe();SRt();MAe();Ree();CAe();nA();TRt();FAe();Lee();gR();yd();PRt();kRt();Ig();NAe();IRt();ds=jRt(tA);ds.Axios=CR;ds.CanceledError=Ed;ds.CancelToken=ORt;ds.isCancel=yR;ds.VERSION=IE;ds.toFormData=kg;ds.AxiosError=pr;ds.Cancel=ds.CanceledError;ds.all=function(t){return Promise.all(t)};ds.spread=zAe;ds.isAxiosError=WAe;ds.mergeConfig=T5;ds.AxiosHeaders=Is;ds.formToJSON=e=>kee(Ct.isHTMLForm(e)?new FormData(e):e);ds.getAdapter=Uee.getAdapter;ds.HttpStatusCode=RRt;ds.default=ds;Wee=ds});var iMu,oMu,sMu,aMu,cMu,lMu,fMu,pMu,hMu,dMu,mMu,gMu,vMu,DMu,yMu,EMu,NRt=wt(()=>{LRt();({Axios:iMu,AxiosError:oMu,CanceledError:sMu,isCancel:aMu,CancelToken:cMu,VERSION:lMu,all:fMu,Cancel:pMu,isAxiosError:hMu,spread:dMu,toFormData:mMu,AxiosHeaders:gMu,HttpStatusCode:vMu,formToJSON:DMu,getAdapter:yMu,mergeConfig:EMu}=Wee)});var qRt,MRt,$o,xR,URt,Gee,LE,VAe=wt(()=>{Eg();qRt=require("child_process");mbe();MRt=ot(nkt());Rr();$o=ot(ar());Dn();skt();eu();vg();Jx();xR=ot(require("path"));NRt();URt=ot(Hr()),Gee=ot(ro()),LE=class{constructor(t={}){this.options=t;aa.registerPrompt("autocomplete",uZ)}async init(){if(Ft.write(`
590
590
  ${(0,Pt.emoji)("\u{1F680}")} More applications: ${Dt.underline("https://registry.serverless-devs.com")}`),this.template=this.options.project,(0,$o.endsWith)(this.options.project,".git"))return await this.gitCloneProject();if(!this.options.project&&!this.options.uri){let r=await this.getApplicationTemplates(),n=await aa.prompt(r);this.template=n.template||n.firstLevel,Ft.write(`
591
591
  ${(0,Pt.emoji)("\u{1F60B}")} Create application command: [s init ${this.template}]
592
- `)}let{appPath:t}=await this.executeInit();t&&Uc("report.js",{type:"init",template:this.template})}async getProjectName(){if(this.options.dir)return xR.default.basename(this.options.dir);let t=(0,$o.last)((0,$o.split)(this.template,"/"));if(this.options.y)return t;let r=await aa.prompt([{type:"input",name:"projectName",message:"Please input your project name (init dir)",default:t,validate:n=>n?!0:"Project name is required"}]);return(0,$o.trim)(r.projectName)}async getInitAliMenu(){return Wee.get("https://images.devsapp.cn/bin/s/ali-template.json").then(r=>{let{data:n}=r;return{ali_template:n.ali_template,contents:n.contents,version:n.version}}).catch(r=>({ali_template:Fee.ali_template,contents:Fee.contents,version:Fee.version}))}async getAliMenu(t){let r;if(Gee.default.existsSync(t))r=Gee.default.readJSONSync(t),Uc("update-templates.js");else{let n=await this.getInitAliMenu();n&&(Gee.default.writeJSONSync(t,n,{spaces:2}),r=n)}return r}async getApplicationTemplates(){let t=xR.default.join((0,URt.getRootHome)(),"config","ali-template.json"),r=await this.getAliMenu(t),n=[...r.ali_template];for(let s of Object.keys(r.contents))n=(0,$o.concat)(n,r.contents[s]);let u=okt.concat(n),i={type:"autocomplete",name:"ali_template",when(s){return s.firstLevel==="Alibaba_Cloud_Serverless"},default:(0,$o.first)(r.ali_template).value,message:"Hello, serverlesser. Which template do you like?",source:async function(s,a){return a?n.filter(c=>(0,$o.lowerCase)(c.name).includes((0,$o.lowerCase)(a))):r.ali_template}};pR.push(i);let o={type:"autocomplete",name:"firstLevel",loop:!0,message:"Hello Serverless for Cloud Vendors",default:(0,$o.first)(Aee).value,when(s){return!0},source:async function(s,a){return a?u.filter(c=>(0,$o.lowerCase)(c.name).includes((0,$o.lowerCase)(a))):Aee}};pR.unshift(o);for(let s of Object.keys(r.contents)){let a={type:"autocomplete",name:"template",loop:!0,when(c){return c.ali_template===s},message:"Which template do you like?",default:(0,$o.first)(r.contents[s]).value,source:async function(c,l){return l?r.contents[s].filter(f=>(0,$o.lowerCase)(f.name).includes((0,$o.lowerCase)(l))):r.contents[s]}};pR.push(a)}return pR}async executeInit(){let t=await(0,MRt.default)(this.template,{dest:this.options.dir&&xR.default.isAbsolute(this.options.dir)?xR.default.dirname(this.options.dir):process.cwd(),logger:Ft,projectName:await this.getProjectName(),parameters:this.options.parameters,appName:this.options.appName,access:this.options.access,uri:this.options.uri,y:this.options.y});return t&&(Ft.write(`
592
+ `)}let{appPath:t}=await this.executeInit();t&&Uc("report.js",{type:"init",template:this.template})}async getProjectName(){if(this.options.dir)return xR.default.basename(this.options.dir);let t=(0,$o.last)((0,$o.split)(this.template,"/"));if(this.options.y)return t;let r=await aa.prompt([{type:"input",name:"projectName",message:"Please input your project name (init dir)",default:t,validate:n=>n?!0:"Project name is required"}]);return(0,$o.trim)(r.projectName)}async getInitAliMenu(){return Wee.get("https://images.devsapp.cn/bin/s/ali-template.json").then(r=>{let{data:n}=r;return{ali_template:n.ali_template,contents:n.contents,version:n.version}}).catch(r=>({ali_template:Fee.ali_template,contents:Fee.contents,version:Fee.version}))}async getAliMenu(t){let r;if(Gee.default.existsSync(t))r=Gee.default.readJSONSync(t),Uc("update-templates.js");else{let n=await this.getInitAliMenu();n&&(Gee.default.writeJSONSync(t,n,{spaces:2}),r=n)}return r}async getApplicationTemplates(){let t=xR.default.join((0,URt.getRootHome)(),"config","ali-template.json"),r=await this.getAliMenu(t),n=[...r.ali_template];for(let s of Object.keys(r.contents))n=(0,$o.concat)(n,r.contents[s]);let u=okt.concat(n),i={type:"autocomplete",name:"ali_template",when(s){return s.firstLevel==="Alibaba_Cloud_Serverless"},default:(0,$o.first)(r.ali_template).value,message:"Hello, serverlesser. Which template do you like?",source:async function(s,a){return a?n.filter(c=>(0,$o.lowerCase)(c.name).includes((0,$o.lowerCase)(a))):r.ali_template}};pR.push(i);let o={type:"autocomplete",name:"firstLevel",loop:!0,message:"Hello Serverless for Cloud Vendors",default:(0,$o.first)(Aee).value,when(s){return!0},source:async function(s,a){return a?u.filter(c=>(0,$o.lowerCase)(c.name).includes((0,$o.lowerCase)(a))):Aee}};pR.unshift(o);for(let s of Object.keys(r.contents)){let a={type:"autocomplete",name:"template",loop:!0,when(c){return c.ali_template===s},message:"Which template do you like?",default:(0,$o.first)(r.contents[s]).value,source:async function(c,l){return l?r.contents[s].filter(f=>(0,$o.lowerCase)(f.name).includes((0,$o.lowerCase)(l))):r.contents[s]}};pR.push(a)}return pR}async executeInit(){let t=await(0,MRt.default)(this.template,{dest:this.options.dir&&xR.default.isAbsolute(this.options.dir)?xR.default.dirname(this.options.dir):process.cwd(),logger:Ft,projectName:await this.getProjectName(),parameters:this.options.parameters,appName:this.options.appName,access:this.options.access,uri:this.options.uri,y:this.options.y,overwrite:this.options.overwrite});return t&&(Ft.write(`
593
593
  ${(0,Pt.emoji)("\u{1F3C4}\u200D")} Thanks for using Serverless-Devs`),Ft.write(`${(0,Pt.emoji)("\u{1F449}")} You could [cd ${t}] and enjoy your serverless journey!`),Ft.write(`${(0,Pt.emoji)("\u{1F9ED}\uFE0F")} If you need help for this example, you can use [s -h] after you enter folder.`),Ft.write(`${(0,Pt.emoji)("\u{1F49E}")} Document \u2764 Star: `+Dt.cyan.underline("https://github.com/Serverless-Devs/Serverless-Devs")),Ft.write(`${(0,Pt.emoji)("\u{1F680}")} More applications: `+Dt.cyan.underline(`https://registry.serverless-devs.com
594
594
  `))),{appPath:t}}async gitCloneProject(){return new Promise(t=>{(0,qRt.spawn)("git",["clone",this.template],{shell:!0,cwd:this.options.dir?this.options.dir:"./",stdio:["ignore","inherit","inherit"]}).on("close",r=>t({code:r}))})}}});var HRt=L((YAe,XAe)=>{"use strict";Object.defineProperty(YAe,"__esModule",{value:!0});function nTn(e){return e.encrypted}var KAe=(e,t)=>{let r;typeof t=="function"?r={connect:t}:r=t;let n=typeof r.connect=="function",u=typeof r.secureConnect=="function",i=typeof r.close=="function",o=()=>{n&&r.connect(),nTn(e)&&u&&(e.authorized?r.secureConnect():e.authorizationError||e.once("secureConnect",r.secureConnect)),i&&e.once("close",r.close)};e.writable&&!e.connecting?o():e.connecting?e.once("connect",o):e.destroyed&&i&&r.close(e._hadError)};YAe.default=KAe;XAe.exports=KAe;XAe.exports.default=KAe});var ZRt=L((GMu,QRt)=>{"use strict";var{PassThrough:lTn}=require("stream");QRt.exports=e=>{e={...e};let{array:t}=e,{encoding:r}=e,n=r==="buffer",u=!1;t?u=!(r||n):r=r||"utf8",n&&(r=null);let i=new lTn({objectMode:u});r&&i.setEncoding(r);let o=0,s=[];return i.on("data",a=>{s.push(a),u?o=s.length:o+=a.length}),i.getBufferedValue=()=>t?s:n?Buffer.concat(s,o):s.join(""),i.getBufferedLength=()=>o,i}});var eIt=L((VMu,BR)=>{"use strict";var{constants:fTn}=require("buffer"),pTn=require("stream"),{promisify:hTn}=require("util"),dTn=ZRt(),mTn=hTn(pTn.pipeline),Qee=class extends Error{constructor(){super("maxBuffer exceeded"),this.name="MaxBufferError"}};async function ZAe(e,t){if(!e)throw new Error("Expected a stream");t={maxBuffer:1/0,...t};let{maxBuffer:r}=t,n=dTn(t);return await new Promise((u,i)=>{let o=s=>{s&&n.getBufferedLength()<=fTn.MAX_LENGTH&&(s.bufferedData=n.getBufferedValue()),i(s)};(async()=>{try{await mTn(e,n),u()}catch(s){o(s)}})(),n.on("data",()=>{n.getBufferedLength()>r&&o(new Qee)})}),n.getBufferedValue()}BR.exports=ZAe;BR.exports.buffer=(e,t)=>ZAe(e,{...t,encoding:"buffer"});BR.exports.array=(e,t)=>ZAe(e,{...t,array:!0});BR.exports.MaxBufferError=Qee});var rIt=L((KMu,tIt)=>{"use strict";var gTn=new Set([200,203,204,206,300,301,308,404,405,410,414,501]),vTn=new Set([200,203,204,300,301,302,303,307,308,404,405,410,414,501]),DTn=new Set([500,502,503,504]),yTn={date:!0,connection:!0,"keep-alive":!0,"proxy-authenticate":!0,"proxy-authorization":!0,te:!0,trailer:!0,"transfer-encoding":!0,upgrade:!0},ETn={"content-length":!0,"content-encoding":!0,"transfer-encoding":!0,"content-range":!0};function NE(e){let t=parseInt(e,10);return isFinite(t)?t:0}function bTn(e){return e?DTn.has(e.status):!0}function eFe(e){let t={};if(!e)return t;let r=e.trim().split(/,/);for(let n of r){let[u,i]=n.split(/=/,2);t[u.trim()]=i===void 0?!0:i.trim().replace(/^"|"$/g,"")}return t}function CTn(e){let t=[];for(let r in e){let n=e[r];t.push(n===!0?r:r+"="+n)}if(t.length)return t.join(", ")}tIt.exports=class{constructor(t,r,{shared:n,cacheHeuristic:u,immutableMinTimeToLive:i,ignoreCargoCult:o,_fromObject:s}={}){if(s){this._fromObject(s);return}if(!r||!r.headers)throw Error("Response headers missing");this._assertRequestHasHeaders(t),this._responseTime=this.now(),this._isShared=n!==!1,this._cacheHeuristic=u!==void 0?u:.1,this._immutableMinTtl=i!==void 0?i:24*3600*1e3,this._status="status"in r?r.status:200,this._resHeaders=r.headers,this._rescc=eFe(r.headers["cache-control"]),this._method="method"in t?t.method:"GET",this._url=t.url,this._host=t.headers.host,this._noAuthorization=!t.headers.authorization,this._reqHeaders=r.headers.vary?t.headers:null,this._reqcc=eFe(t.headers["cache-control"]),o&&"pre-check"in this._rescc&&"post-check"in this._rescc&&(delete this._rescc["pre-check"],delete this._rescc["post-check"],delete this._rescc["no-cache"],delete this._rescc["no-store"],delete this._rescc["must-revalidate"],this._resHeaders=Object.assign({},this._resHeaders,{"cache-control":CTn(this._rescc)}),delete this._resHeaders.expires,delete this._resHeaders.pragma),r.headers["cache-control"]==null&&/no-cache/.test(r.headers.pragma)&&(this._rescc["no-cache"]=!0)}now(){return Date.now()}storable(){return!!(!this._reqcc["no-store"]&&(this._method==="GET"||this._method==="HEAD"||this._method==="POST"&&this._hasExplicitExpiration())&&vTn.has(this._status)&&!this._rescc["no-store"]&&(!this._isShared||!this._rescc.private)&&(!this._isShared||this._noAuthorization||this._allowsStoringAuthenticated())&&(this._resHeaders.expires||this._rescc["max-age"]||this._isShared&&this._rescc["s-maxage"]||this._rescc.public||gTn.has(this._status)))}_hasExplicitExpiration(){return this._isShared&&this._rescc["s-maxage"]||this._rescc["max-age"]||this._resHeaders.expires}_assertRequestHasHeaders(t){if(!t||!t.headers)throw Error("Request headers missing")}satisfiesWithoutRevalidation(t){this._assertRequestHasHeaders(t);let r=eFe(t.headers["cache-control"]);return r["no-cache"]||/no-cache/.test(t.headers.pragma)||r["max-age"]&&this.age()>r["max-age"]||r["min-fresh"]&&this.timeToLive()<1e3*r["min-fresh"]||this.stale()&&!(r["max-stale"]&&!this._rescc["must-revalidate"]&&(r["max-stale"]===!0||r["max-stale"]>this.age()-this.maxAge()))?!1:this._requestMatches(t,!1)}_requestMatches(t,r){return(!this._url||this._url===t.url)&&this._host===t.headers.host&&(!t.method||this._method===t.method||r&&t.method==="HEAD")&&this._varyMatches(t)}_allowsStoringAuthenticated(){return this._rescc["must-revalidate"]||this._rescc.public||this._rescc["s-maxage"]}_varyMatches(t){if(!this._resHeaders.vary)return!0;if(this._resHeaders.vary==="*")return!1;let r=this._resHeaders.vary.trim().toLowerCase().split(/\s*,\s*/);for(let n of r)if(t.headers[n]!==this._reqHeaders[n])return!1;return!0}_copyWithoutHopByHopHeaders(t){let r={};for(let n in t)yTn[n]||(r[n]=t[n]);if(t.connection){let n=t.connection.trim().split(/\s*,\s*/);for(let u of n)delete r[u]}if(r.warning){let n=r.warning.split(/,/).filter(u=>!/^\s*1[0-9][0-9]/.test(u));n.length?r.warning=n.join(",").trim():delete r.warning}return r}responseHeaders(){let t=this._copyWithoutHopByHopHeaders(this._resHeaders),r=this.age();return r>3600*24&&!this._hasExplicitExpiration()&&this.maxAge()>3600*24&&(t.warning=(t.warning?`${t.warning}, `:"")+'113 - "rfc7234 5.5.4"'),t.age=`${Math.round(r)}`,t.date=new Date(this.now()).toUTCString(),t}date(){let t=Date.parse(this._resHeaders.date);return isFinite(t)?t:this._responseTime}age(){let t=this._ageValue(),r=(this.now()-this._responseTime)/1e3;return t+r}_ageValue(){return NE(this._resHeaders.age)}maxAge(){if(!this.storable()||this._rescc["no-cache"]||this._isShared&&this._resHeaders["set-cookie"]&&!this._rescc.public&&!this._rescc.immutable||this._resHeaders.vary==="*")return 0;if(this._isShared){if(this._rescc["proxy-revalidate"])return 0;if(this._rescc["s-maxage"])return NE(this._rescc["s-maxage"])}if(this._rescc["max-age"])return NE(this._rescc["max-age"]);let t=this._rescc.immutable?this._immutableMinTtl:0,r=this.date();if(this._resHeaders.expires){let n=Date.parse(this._resHeaders.expires);return Number.isNaN(n)||n<r?0:Math.max(t,(n-r)/1e3)}if(this._resHeaders["last-modified"]){let n=Date.parse(this._resHeaders["last-modified"]);if(isFinite(n)&&r>n)return Math.max(t,(r-n)/1e3*this._cacheHeuristic)}return t}timeToLive(){let t=this.maxAge()-this.age(),r=t+NE(this._rescc["stale-if-error"]),n=t+NE(this._rescc["stale-while-revalidate"]);return Math.max(0,t,r,n)*1e3}stale(){return this.maxAge()<=this.age()}_useStaleIfError(){return this.maxAge()+NE(this._rescc["stale-if-error"])>this.age()}useStaleWhileRevalidate(){return this.maxAge()+NE(this._rescc["stale-while-revalidate"])>this.age()}static fromObject(t){return new this(void 0,void 0,{_fromObject:t})}_fromObject(t){if(this._responseTime)throw Error("Reinitialized");if(!t||t.v!==1)throw Error("Invalid serialization");this._responseTime=t.t,this._isShared=t.sh,this._cacheHeuristic=t.ch,this._immutableMinTtl=t.imm!==void 0?t.imm:24*3600*1e3,this._status=t.st,this._resHeaders=t.resh,this._rescc=t.rescc,this._method=t.m,this._url=t.u,this._host=t.h,this._noAuthorization=t.a,this._reqHeaders=t.reqh,this._reqcc=t.reqcc}toObject(){return{v:1,t:this._responseTime,sh:this._isShared,ch:this._cacheHeuristic,imm:this._immutableMinTtl,st:this._status,resh:this._resHeaders,rescc:this._rescc,m:this._method,u:this._url,h:this._host,a:this._noAuthorization,reqh:this._reqHeaders,reqcc:this._reqcc}}revalidationHeaders(t){this._assertRequestHasHeaders(t);let r=this._copyWithoutHopByHopHeaders(t.headers);if(delete r["if-range"],!this._requestMatches(t,!0)||!this.storable())return delete r["if-none-match"],delete r["if-modified-since"],r;if(this._resHeaders.etag&&(r["if-none-match"]=r["if-none-match"]?`${r["if-none-match"]}, ${this._resHeaders.etag}`:this._resHeaders.etag),r["accept-ranges"]||r["if-match"]||r["if-unmodified-since"]||this._method&&this._method!="GET"){if(delete r["if-modified-since"],r["if-none-match"]){let u=r["if-none-match"].split(/,/).filter(i=>!/^\s*W\//.test(i));u.length?r["if-none-match"]=u.join(",").trim():delete r["if-none-match"]}}else this._resHeaders["last-modified"]&&!r["if-modified-since"]&&(r["if-modified-since"]=this._resHeaders["last-modified"]);return r}revalidatedPolicy(t,r){if(this._assertRequestHasHeaders(t),this._useStaleIfError()&&bTn(r))return{modified:!1,matches:!1,policy:this};if(!r||!r.headers)throw Error("Response headers missing");let n=!1;if(r.status!==void 0&&r.status!=304?n=!1:r.headers.etag&&!/^\s*W\//.test(r.headers.etag)?n=this._resHeaders.etag&&this._resHeaders.etag.replace(/^\s*W\//,"")===r.headers.etag:this._resHeaders.etag&&r.headers.etag?n=this._resHeaders.etag.replace(/^\s*W\//,"")===r.headers.etag.replace(/^\s*W\//,""):this._resHeaders["last-modified"]?n=this._resHeaders["last-modified"]===r.headers["last-modified"]:!this._resHeaders.etag&&!this._resHeaders["last-modified"]&&!r.headers.etag&&!r.headers["last-modified"]&&(n=!0),!n)return{policy:new this.constructor(t,r),modified:r.status!=304,matches:!1};let u={};for(let o in this._resHeaders)u[o]=o in r.headers&&!ETn[o]?r.headers[o]:this._resHeaders[o];let i=Object.assign({},r,{status:this._status,method:this._method,headers:u});return{policy:new this.constructor(t,i,{shared:this._isShared,cacheHeuristic:this._cacheHeuristic,immutableMinTimeToLive:this._immutableMinTtl}),modified:!1,matches:!0}}}});var uIt=L(tFe=>{tFe.stringify=function e(t){if(typeof t>"u")return t;if(t&&Buffer.isBuffer(t))return JSON.stringify(":base64:"+t.toString("base64"));if(t&&t.toJSON&&(t=t.toJSON()),t&&typeof t=="object"){var r="",n=Array.isArray(t);r=n?"[":"{";var u=!0;for(var i in t){var o=typeof t[i]=="function"||!n&&typeof t[i]>"u";Object.hasOwnProperty.call(t,i)&&!o&&(u||(r+=","),u=!1,n?t[i]==null?r+="null":r+=e(t[i]):t[i]!==void 0&&(r+=e(i)+":"+e(t[i])))}return r+=n?"]":"}",r}else return typeof t=="string"?JSON.stringify(/^:/.test(t)?":"+t:t):typeof t>"u"?"null":JSON.stringify(t)};tFe.parse=function(e){return JSON.parse(e,function(t,r){return typeof r=="string"?/^:base64:/.test(r)?Buffer.from(r.substring(8),"base64"):/^:/.test(r)?r.substring(1):r:r})}});var aIt=L((ZMu,sIt)=>{"use strict";var xTn=require("events"),iIt=uIt(),ATn=e=>{let t={redis:"@keyv/redis",rediss:"@keyv/redis",mongodb:"@keyv/mongo",mongo:"@keyv/mongo",sqlite:"@keyv/sqlite",postgresql:"@keyv/postgres",postgres:"@keyv/postgres",mysql:"@keyv/mysql",etcd:"@keyv/etcd",offline:"@keyv/offline",tiered:"@keyv/tiered"};if(e.adapter||e.uri){let r=e.adapter||/^[^:+]*/.exec(e.uri)[0];return new(require(t[r]))(e)}return new Map},oIt=["sqlite","postgres","mysql","mongo","redis","tiered"],rFe=class extends xTn{constructor(t,{emitErrors:r=!0,...n}={}){if(super(),this.opts={namespace:"keyv",serialize:iIt.stringify,deserialize:iIt.parse,...typeof t=="string"?{uri:t}:t,...n},!this.opts.store){let i={...this.opts};this.opts.store=ATn(i)}if(this.opts.compression){let i=this.opts.compression;this.opts.serialize=i.serialize.bind(i),this.opts.deserialize=i.deserialize.bind(i)}typeof this.opts.store.on=="function"&&r&&this.opts.store.on("error",i=>this.emit("error",i)),this.opts.store.namespace=this.opts.namespace;let u=i=>async function*(){for await(let[o,s]of typeof i=="function"?i(this.opts.store.namespace):i){let a=await this.opts.deserialize(s);if(!(this.opts.store.namespace&&!o.includes(this.opts.store.namespace))){if(typeof a.expires=="number"&&Date.now()>a.expires){this.delete(o);continue}yield[this._getKeyUnprefix(o),a.value]}}};typeof this.opts.store[Symbol.iterator]=="function"&&this.opts.store instanceof Map?this.iterator=u(this.opts.store):typeof this.opts.store.iterator=="function"&&this.opts.store.opts&&this._checkIterableAdaptar()&&(this.iterator=u(this.opts.store.iterator.bind(this.opts.store)))}_checkIterableAdaptar(){return oIt.includes(this.opts.store.opts.dialect)||oIt.findIndex(t=>this.opts.store.opts.url.includes(t))>=0}_getKeyPrefix(t){return`${this.opts.namespace}:${t}`}_getKeyPrefixArray(t){return t.map(r=>`${this.opts.namespace}:${r}`)}_getKeyUnprefix(t){return t.split(":").splice(1).join(":")}get(t,r){let{store:n}=this.opts,u=Array.isArray(t),i=u?this._getKeyPrefixArray(t):this._getKeyPrefix(t);if(u&&n.getMany===void 0){let o=[];for(let s of i)o.push(Promise.resolve().then(()=>n.get(s)).then(a=>typeof a=="string"?this.opts.deserialize(a):this.opts.compression?this.opts.deserialize(a):a).then(a=>{if(a!=null)return typeof a.expires=="number"&&Date.now()>a.expires?this.delete(s).then(()=>{}):r&&r.raw?a:a.value}));return Promise.allSettled(o).then(s=>{let a=[];for(let c of s)a.push(c.value);return a})}return Promise.resolve().then(()=>u?n.getMany(i):n.get(i)).then(o=>typeof o=="string"?this.opts.deserialize(o):this.opts.compression?this.opts.deserialize(o):o).then(o=>{if(o!=null)return u?o.map((s,a)=>{if(typeof s=="string"&&(s=this.opts.deserialize(s)),s!=null){if(typeof s.expires=="number"&&Date.now()>s.expires){this.delete(t[a]).then(()=>{});return}return r&&r.raw?s:s.value}}):typeof o.expires=="number"&&Date.now()>o.expires?this.delete(t).then(()=>{}):r&&r.raw?o:o.value})}set(t,r,n){let u=this._getKeyPrefix(t);typeof n>"u"&&(n=this.opts.ttl),n===0&&(n=void 0);let{store:i}=this.opts;return Promise.resolve().then(()=>{let o=typeof n=="number"?Date.now()+n:null;return typeof r=="symbol"&&this.emit("error","symbol cannot be serialized"),r={value:r,expires:o},this.opts.serialize(r)}).then(o=>i.set(u,o,n)).then(()=>!0)}delete(t){let{store:r}=this.opts;if(Array.isArray(t)){let u=this._getKeyPrefixArray(t);if(r.deleteMany===void 0){let i=[];for(let o of u)i.push(r.delete(o));return Promise.allSettled(i).then(o=>o.every(s=>s.value===!0))}return Promise.resolve().then(()=>r.deleteMany(u))}let n=this._getKeyPrefix(t);return Promise.resolve().then(()=>r.delete(n))}clear(){let{store:t}=this.opts;return Promise.resolve().then(()=>t.clear())}has(t){let r=this._getKeyPrefix(t),{store:n}=this.opts;return Promise.resolve().then(async()=>typeof n.has=="function"?n.has(r):await n.get(r)!==void 0)}disconnect(){let{store:t}=this.opts;if(typeof t.disconnect=="function")return t.disconnect()}};sIt.exports=rFe});var mIt=L((aUu,dIt)=>{"use strict";var STn=["aborted","complete","headers","httpVersion","httpVersionMinor","httpVersionMajor","method","rawHeaders","rawTrailers","setTimeout","socket","statusCode","statusMessage","trailers","url"];dIt.exports=(e,t)=>{if(t._readableState.autoDestroy)throw new Error("The second stream must have the `autoDestroy` option set to `false`");let r=new Set(Object.keys(e).concat(STn)),n={};for(let u of r)u in t||(n[u]={get(){let i=e[u];return typeof i=="function"?i.bind(e):i},set(i){e[u]=i},enumerable:!0,configurable:!1});return Object.defineProperties(t,n),e.once("aborted",()=>{t.destroy(),t.emit("aborted")}),e.once("close",()=>{e.complete&&t.readable?t.once("end",()=>{t.emit("close")}):t.emit("close")}),t}});var vIt=L((cUu,gIt)=>{"use strict";var{Transform:OTn,PassThrough:TTn}=require("stream"),oFe=require("zlib"),PTn=mIt();gIt.exports=e=>{let t=(e.headers["content-encoding"]||"").toLowerCase();if(!["gzip","deflate","br"].includes(t))return e;let r=t==="br";if(r&&typeof oFe.createBrotliDecompress!="function")return e.destroy(new Error("Brotli is not supported on Node.js < 12")),e;let n=!0,u=new OTn({transform(s,a,c){n=!1,c(null,s)},flush(s){s()}}),i=new TTn({autoDestroy:!1,destroy(s,a){e.destroy(),a(s)}}),o=r?oFe.createBrotliDecompress():oFe.createUnzip();return o.once("error",s=>{if(n&&!e.readable){i.end();return}i.destroy(s)}),PTn(e,i),e.pipe(u).pipe(o).pipe(i),i}});var yIt=L((lUu,DIt)=>{"use strict";var{PassThrough:kTn}=require("stream");DIt.exports=e=>{e={...e};let{array:t}=e,{encoding:r}=e,n=r==="buffer",u=!1;t?u=!(r||n):r=r||"utf8",n&&(r=null);let i=new kTn({objectMode:u});r&&i.setEncoding(r);let o=0,s=[];return i.on("data",a=>{s.push(a),u?o=s.length:o+=a.length}),i.getBufferedValue=()=>t?s:n?Buffer.concat(s,o):s.join(""),i.getBufferedLength=()=>o,i}});var EIt=L((fUu,OR)=>{"use strict";var{constants:RTn}=require("buffer"),ITn=require("stream"),{promisify:jTn}=require("util"),LTn=yIt(),NTn=jTn(ITn.pipeline),rte=class extends Error{constructor(){super("maxBuffer exceeded"),this.name="MaxBufferError"}};async function sFe(e,t){if(!e)throw new Error("Expected a stream");t={maxBuffer:1/0,...t};let{maxBuffer:r}=t,n=LTn(t);return await new Promise((u,i)=>{let o=s=>{s&&n.getBufferedLength()<=RTn.MAX_LENGTH&&(s.bufferedData=n.getBufferedValue()),i(s)};(async()=>{try{await NTn(e,n),u()}catch(s){o(s)}})(),n.on("data",()=>{n.getBufferedLength()>r&&o(new rte)})}),n.getBufferedValue()}OR.exports=sFe;OR.exports.buffer=(e,t)=>sFe(e,{...t,encoding:"buffer"});OR.exports.array=(e,t)=>sFe(e,{...t,array:!0});OR.exports.MaxBufferError=rte});var DFe=L((HUu,NIt)=>{"use strict";var vFe=class{constructor(t={}){if(!(t.maxSize&&t.maxSize>0))throw new TypeError("`maxSize` must be a number greater than 0");this.maxSize=t.maxSize,this.onEviction=t.onEviction,this.cache=new Map,this.oldCache=new Map,this._size=0}_set(t,r){if(this.cache.set(t,r),this._size++,this._size>=this.maxSize){if(this._size=0,typeof this.onEviction=="function")for(let[n,u]of this.oldCache.entries())this.onEviction(n,u);this.oldCache=this.cache,this.cache=new Map}}get(t){if(this.cache.has(t))return this.cache.get(t);if(this.oldCache.has(t)){let r=this.oldCache.get(t);return this.oldCache.delete(t),this._set(t,r),r}}set(t,r){return this.cache.has(t)?this.cache.set(t,r):this._set(t,r),this}has(t){return this.cache.has(t)||this.oldCache.has(t)}peek(t){if(this.cache.has(t))return this.cache.get(t);if(this.oldCache.has(t))return this.oldCache.get(t)}delete(t){let r=this.cache.delete(t);return r&&this._size--,this.oldCache.delete(t)||r}clear(){this.cache.clear(),this.oldCache.clear(),this._size=0}*keys(){for(let[t]of this)yield t}*values(){for(let[,t]of this)yield t}*[Symbol.iterator](){for(let t of this.cache)yield t;for(let t of this.oldCache){let[r]=t;this.cache.has(r)||(yield t)}}get size(){let t=0;for(let r of this.oldCache.keys())this.cache.has(r)||t++;return Math.min(this._size+t,this.maxSize)}};NIt.exports=vFe});var yFe=L((KUu,qIt)=>{"use strict";qIt.exports=e=>{if(e.listenerCount("error")!==0)return e;e.__destroy=e._destroy,e._destroy=(...r)=>{let n=r.pop();e.__destroy(...r,async u=>{await Promise.resolve(),n(u)})};let t=r=>{Promise.resolve().then(()=>{e.emit("error",r)})};return e.once("error",t),Promise.resolve().then(()=>{e.off("error",t)}),e}});var ME=L((YUu,GIt)=>{"use strict";var{URL:MIt}=require("url"),JTn=require("events"),QTn=require("tls"),ZTn=require("http2"),ePn=DFe(),tPn=yFe(),Tl=Symbol("currentStreamCount"),UIt=Symbol("request"),Pl=Symbol("cachedOriginSet"),$g=Symbol("gracefullyClosing"),cte=Symbol("length"),$It=["createConnection","maxDeflateDynamicTableSize","maxSettings","maxSessionMemory","maxHeaderListPairs","maxOutstandingPings","maxReservedRemoteStreams","maxSendHeaderBlockLength","paddingStrategy","peerMaxConcurrentStreams","settings","family","localAddress","rejectUnauthorized","pskCallback","minDHSize","path","socket","ca","cert","sigalgs","ciphers","clientCertEngine","crl","dhparam","ecdhCurve","honorCipherOrder","key","privateKeyEngine","privateKeyIdentifier","maxVersion","minVersion","pfx","secureOptions","secureProtocol","sessionIdContext","ticketKeys"],rPn=(e,t,r)=>{let n=0,u=e.length;for(;n<u;){let i=n+u>>>1;r(e[i],t)?n=i+1:u=i}return n},nPn=(e,t)=>e.remoteSettings.maxConcurrentStreams>t.remoteSettings.maxConcurrentStreams,EFe=(e,t)=>{for(let r=0;r<e.length;r++){let n=e[r];n[Pl].length>0&&n[Pl].length<t[Pl].length&&n[Pl].every(u=>t[Pl].includes(u))&&n[Tl]+t[Tl]<=t.remoteSettings.maxConcurrentStreams&&WIt(n)}},zIt=(e,t)=>{for(let r=0;r<e.length;r++){let n=e[r];if(t[Pl].length>0&&t[Pl].length<n[Pl].length&&t[Pl].every(u=>n[Pl].includes(u))&&t[Tl]+n[Tl]<=n.remoteSettings.maxConcurrentStreams)return WIt(t),!0}return!1},WIt=e=>{e[$g]=!0,e[Tl]===0&&e.close()},fA=class e extends JTn{constructor({timeout:t=0,maxSessions:r=Number.POSITIVE_INFINITY,maxEmptySessions:n=10,maxCachedTlsSessions:u=100}={}){super(),this.sessions={},this.queue={},this.timeout=t,this.maxSessions=r,this.maxEmptySessions=n,this._emptySessionCount=0,this._sessionCount=0,this.settings={enablePush:!1,initialWindowSize:1024*1024*32},this.tlsSessionCache=new ePn({maxSize:u})}get protocol(){return"https:"}normalizeOptions(t){let r="";for(let n=0;n<$It.length;n++){let u=$It[n];r+=":",t&&t[u]!==void 0&&(r+=t[u])}return r}_processQueue(){if(this._sessionCount>=this.maxSessions){this.closeEmptySessions(this.maxSessions-this._sessionCount+1);return}for(let t in this.queue)for(let r in this.queue[t]){let n=this.queue[t][r];n.completed||(n.completed=!0,n())}}_isBetterSession(t,r){return t>r}_accept(t,r,n,u){let i=0;for(;i<r.length&&t[Tl]<t.remoteSettings.maxConcurrentStreams;)r[i].resolve(t),i++;r.splice(0,i),r.length>0&&(this.getSession(n,u,r),r.length=0)}getSession(t,r,n){return new Promise((u,i)=>{Array.isArray(n)&&n.length>0?(n=[...n],u()):n=[{resolve:u,reject:i}];try{if(typeof t=="string")t=new MIt(t);else if(!(t instanceof MIt))throw new TypeError("The `origin` argument needs to be a string or an URL object");if(r){let{servername:l}=r,{hostname:f}=t;if(l&&f!==l)throw new Error(`Origin ${f} differs from servername ${l}`)}}catch(l){for(let f=0;f<n.length;f++)n[f].reject(l);return}let o=this.normalizeOptions(r),s=t.origin;if(o in this.sessions){let l=this.sessions[o],f=-1,p=-1,h;for(let d=0;d<l.length;d++){let m=l[d],v=m.remoteSettings.maxConcurrentStreams;if(v<f)break;if(!m[Pl].includes(s))continue;let y=m[Tl];y>=v||m[$g]||m.destroyed||(h||(f=v),this._isBetterSession(y,p)&&(h=m,p=y))}if(h){this._accept(h,n,s,r);return}}if(o in this.queue){if(s in this.queue[o]){this.queue[o][s].listeners.push(...n);return}}else this.queue[o]={[cte]:0};let a=()=>{o in this.queue&&this.queue[o][s]===c&&(delete this.queue[o][s],--this.queue[o][cte]===0&&delete this.queue[o])},c=async()=>{this._sessionCount++;let l=`${s}:${o}`,f=!1,p;try{let h={...r};h.settings===void 0&&(h.settings=this.settings),h.session===void 0&&(h.session=this.tlsSessionCache.get(l)),p=await(h.createConnection||this.createConnection).call(this,t,h),h.createConnection=()=>p;let m=ZTn.connect(t,h);m[Tl]=0,m[$g]=!1;let v=()=>{let{socket:D}=m,E;return D.servername===!1?(D.servername=D.remoteAddress,E=m.originSet,D.servername=!1):E=m.originSet,E},y=()=>m[Tl]<m.remoteSettings.maxConcurrentStreams;m.socket.once("session",D=>{this.tlsSessionCache.set(l,D)}),m.once("error",D=>{for(let E=0;E<n.length;E++)n[E].reject(D);this.tlsSessionCache.delete(l)}),m.setTimeout(this.timeout,()=>{m.destroy()}),m.once("close",()=>{if(this._sessionCount--,f){this._emptySessionCount--;let D=this.sessions[o];D.length===1?delete this.sessions[o]:D.splice(D.indexOf(m),1)}else{a();let D=new Error("Session closed without receiving a SETTINGS frame");D.code="HTTP2WRAPPER_NOSETTINGS";for(let E=0;E<n.length;E++)n[E].reject(D)}this._processQueue()});let g=()=>{let D=this.queue[o];if(!D)return;let E=m[Pl];for(let b=0;b<E.length;b++){let C=E[b];if(C in D){let{listeners:x,completed:F}=D[C],A=0;for(;A<x.length&&y();)x[A].resolve(m),A++;if(D[C].listeners.splice(0,A),D[C].listeners.length===0&&!F&&(delete D[C],--D[cte]===0)){delete this.queue[o];break}if(!y())break}}};m.on("origin",()=>{m[Pl]=v()||[],m[$g]=!1,zIt(this.sessions[o],m),!(m[$g]||!y())&&(g(),y()&&EFe(this.sessions[o],m))}),m.once("remoteSettings",()=>{if(c.destroyed){let D=new Error("Agent has been destroyed");for(let E=0;E<n.length;E++)n[E].reject(D);m.destroy();return}if(m.setLocalWindowSize&&m.setLocalWindowSize(1024*1024*4),m[Pl]=v()||[],m.socket.encrypted){let D=m[Pl][0];if(D!==s){let E=new Error(`Requested origin ${s} does not match server ${D}`);for(let b=0;b<n.length;b++)n[b].reject(E);m.destroy();return}}a();{let D=this.sessions;if(o in D){let E=D[o];E.splice(rPn(E,m,nPn),0,m)}else D[o]=[m]}f=!0,this._emptySessionCount++,this.emit("session",m),this._accept(m,n,s,r),m[Tl]===0&&this._emptySessionCount>this.maxEmptySessions&&this.closeEmptySessions(this._emptySessionCount-this.maxEmptySessions),m.on("remoteSettings",()=>{y()&&(g(),y()&&EFe(this.sessions[o],m))})}),m[UIt]=m.request,m.request=(D,E)=>{if(m[$g])throw new Error("The session is gracefully closing. No new streams are allowed.");let b=m[UIt](D,E);return m.ref(),m[Tl]++===0&&this._emptySessionCount--,b.once("close",()=>{if(--m[Tl]===0&&(this._emptySessionCount++,m.unref(),this._emptySessionCount>this.maxEmptySessions||m[$g])){m.close();return}m.destroyed||m.closed||y()&&!zIt(this.sessions[o],m)&&(EFe(this.sessions[o],m),g(),m[Tl]===0&&this._processQueue())}),b}}catch(h){a(),this._sessionCount--;for(let d=0;d<n.length;d++)n[d].reject(h)}};c.listeners=n,c.completed=!1,c.destroyed=!1,this.queue[o][s]=c,this.queue[o][cte]++,this._processQueue()})}request(t,r,n,u){return new Promise((i,o)=>{this.getSession(t,r,[{reject:o,resolve:s=>{try{let a=s.request(n,u);tPn(a),i(a)}catch(a){o(a)}}}])})}async createConnection(t,r){return e.connect(t,r)}static connect(t,r){r.ALPNProtocols=["h2"];let n=t.port||443,u=t.hostname;typeof r.servername>"u"&&(r.servername=u);let i=QTn.connect(n,u,r);return r.socket&&(i._peername={family:void 0,address:void 0,port:n}),i}closeEmptySessions(t=Number.POSITIVE_INFINITY){let r=0,{sessions:n}=this;for(let u in n){let i=n[u];for(let o=0;o<i.length;o++){let s=i[o];if(s[Tl]===0&&(r++,s.close(),r>=t))return r}}return r}destroy(t){let{sessions:r,queue:n}=this;for(let u in r){let i=r[u];for(let o=0;o<i.length;o++)i[o].destroy(t)}for(let u in n){let i=n[u];for(let o in i)i[o].destroyed=!0}this.queue={},this.tlsSessionCache.clear()}get emptySessionCount(){return this._emptySessionCount}get pendingSessionCount(){return this._sessionCount-this._emptySessionCount}get sessionCount(){return this._sessionCount}};fA.kCurrentStreamCount=Tl;fA.kGracefullyClosing=$g;GIt.exports={Agent:fA,globalAgent:new fA}});var CFe=L((XUu,VIt)=>{"use strict";var{Readable:uPn}=require("stream"),bFe=class extends uPn{constructor(t,r){super({emitClose:!1,autoDestroy:!0,highWaterMark:r}),this.statusCode=null,this.statusMessage="",this.httpVersion="2.0",this.httpVersionMajor=2,this.httpVersionMinor=0,this.headers={},this.trailers={},this.req=null,this.aborted=!1,this.complete=!1,this.upgrade=null,this.rawHeaders=[],this.rawTrailers=[],this.socket=t,this._dumped=!1}get connection(){return this.socket}set connection(t){this.socket=t}_destroy(t,r){this.readableEnded||(this.aborted=!0),r(),this.req._request.destroy(t)}setTimeout(t,r){return this.req.setTimeout(t,r),this}_dump(){this._dumped||(this._dumped=!0,this.removeAllListeners("data"),this.resume())}_read(){this.req&&this.req._request.resume()}};VIt.exports=bFe});var KIt=L((JUu,HIt)=>{"use strict";HIt.exports=(e,t,r)=>{for(let n of r)e.on(n,(...u)=>t.emit(n,...u))}});var $R=L((ZUu,YIt)=>{"use strict";var UE=(e,t,r)=>{YIt.exports[t]=class extends e{constructor(...u){super(typeof r=="string"?r:r(u)),this.name=`${super.name} [${t}]`,this.code=t}}};UE(TypeError,"ERR_INVALID_ARG_TYPE",e=>{let t=e[0].includes(".")?"property":"argument",r=e[1],n=Array.isArray(r);return n&&(r=`${r.slice(0,-1).join(", ")} or ${r.slice(-1)}`),`The "${e[0]}" ${t} must be ${n?"one of":"of"} type ${r}. Received ${typeof e[2]}`});UE(TypeError,"ERR_INVALID_PROTOCOL",e=>`Protocol "${e[0]}" not supported. Expected "${e[1]}"`);UE(Error,"ERR_HTTP_HEADERS_SENT",e=>`Cannot ${e[0]} headers after they are sent to the client`);UE(TypeError,"ERR_INVALID_HTTP_TOKEN",e=>`${e[0]} must be a valid HTTP token [${e[1]}]`);UE(TypeError,"ERR_HTTP_INVALID_HEADER_VALUE",e=>`Invalid value "${e[0]} for header "${e[1]}"`);UE(TypeError,"ERR_INVALID_CHAR",e=>`Invalid character in ${e[0]} [${e[1]}]`);UE(Error,"ERR_HTTP2_NO_SOCKET_MANIPULATION","HTTP/2 sockets should not be directly manipulated (e.g. read and written)")});var JIt=L((e$u,XIt)=>{"use strict";XIt.exports=e=>{switch(e){case":method":case":scheme":case":authority":case":path":return!0;default:return!1}}});var xFe=L((t$u,QIt)=>{"use strict";var{ERR_INVALID_HTTP_TOKEN:iPn}=$R(),oPn=JIt(),sPn=/^[\^`\-\w!#$%&*+.|~]+$/;QIt.exports=e=>{if(typeof e!="string"||!sPn.test(e)&&!oPn(e))throw new iPn("Header name",e)}});var AFe=L((r$u,ZIt)=>{"use strict";var{ERR_HTTP_INVALID_HEADER_VALUE:aPn,ERR_INVALID_CHAR:cPn}=$R(),lPn=/[^\t\u0020-\u007E\u0080-\u00FF]/;ZIt.exports=(e,t)=>{if(typeof t>"u")throw new aPn(t,e);if(lPn.test(t))throw new cPn("header content",e)}});var rjt=L((n$u,tjt)=>{"use strict";var{ERR_HTTP2_NO_SOCKET_MANIPULATION:ejt}=$R(),fPn={has(e,t){let r=e.session===void 0?e:e.session.socket;return t in e||t in r},get(e,t){switch(t){case"on":case"once":case"end":case"emit":case"destroy":return e[t].bind(e);case"writable":case"destroyed":return e[t];case"readable":return e.destroyed?!1:e.readable;case"setTimeout":{let{session:r}=e;return r!==void 0?r.setTimeout.bind(r):e.setTimeout.bind(e)}case"write":case"read":case"pause":case"resume":throw new ejt;default:{let r=e.session===void 0?e:e.session.socket,n=r[t];return typeof n=="function"?n.bind(r):n}}},getPrototypeOf(e){return e.session!==void 0?Reflect.getPrototypeOf(e.session.socket):Reflect.getPrototypeOf(e)},set(e,t,r){switch(t){case"writable":case"readable":case"destroyed":case"on":case"once":case"end":case"emit":case"destroy":return e[t]=r,!0;case"setTimeout":{let{session:n}=e;return n===void 0?e.setTimeout=r:n.setTimeout=r,!0}case"write":case"read":case"pause":case"resume":throw new ejt;default:{let n=e.session===void 0?e:e.session.socket;return n[t]=r,!0}}}};tjt.exports=fPn});var wFe=L((u$u,ajt)=>{"use strict";var{URL:FFe,urlToHttpOptions:njt}=require("url"),pPn=require("http2"),{Writable:hPn}=require("stream"),{Agent:dPn,globalAgent:mPn}=ME(),gPn=CFe(),vPn=KIt(),{ERR_INVALID_ARG_TYPE:lte,ERR_INVALID_PROTOCOL:DPn,ERR_HTTP_HEADERS_SENT:ujt}=$R(),yPn=xFe(),EPn=AFe(),bPn=rjt(),{HTTP2_HEADER_STATUS:ijt,HTTP2_HEADER_METHOD:ojt,HTTP2_HEADER_PATH:sjt,HTTP2_HEADER_AUTHORITY:zR,HTTP2_METHOD_CONNECT:CPn}=pPn.constants,tc=Symbol("headers"),pA=Symbol("origin"),WR=Symbol("session"),_Fe=Symbol("options"),fte=Symbol("flushedHeaders"),hA=Symbol("jobs"),GR=Symbol("pendingAgentPromise"),BFe=class extends hPn{constructor(t,r,n){if(super({autoDestroy:!1,emitClose:!1}),typeof t=="string"?t=njt(new FFe(t)):t instanceof FFe?t=njt(t):t={...t},typeof r=="function"||r===void 0?(n=r,r=t):r=Object.assign(t,r),r.h2session){if(this[WR]=r.h2session,this[WR].destroyed)throw new Error("The session has been closed already");this.protocol=this[WR].socket.encrypted?"https:":"http:"}else if(r.agent===!1)this.agent=new dPn({maxEmptySessions:0});else if(typeof r.agent>"u"||r.agent===null)this.agent=mPn;else if(typeof r.agent.request=="function")this.agent=r.agent;else throw new lte("options.agent",["http2wrapper.Agent-like Object","undefined","false"],r.agent);if(this.agent&&(this.protocol=this.agent.protocol),r.protocol&&r.protocol!==this.protocol)throw new DPn(r.protocol,this.protocol);r.port||(r.port=r.defaultPort||this.agent&&this.agent.defaultPort||443),r.host=r.hostname||r.host||"localhost",delete r.hostname;let{timeout:u}=r;r.timeout=void 0,this[tc]=Object.create(null),this[hA]=[],this[GR]=void 0,this.socket=null,this.connection=null,this.method=r.method||"GET",this.method==="CONNECT"&&(r.path==="/"||r.path===void 0)||(this.path=r.path),this.res=null,this.aborted=!1,this.reusedSocket=!1;let{headers:i}=r;if(i)for(let s in i)this.setHeader(s,i[s]);r.auth&&!("authorization"in this[tc])&&(this[tc].authorization="Basic "+Buffer.from(r.auth).toString("base64")),r.session=r.tlsSession,r.path=r.socketPath,this[_Fe]=r,this[pA]=new FFe(`${this.protocol}//${r.servername||r.host}:${r.port}`);let o=r._reuseSocket;o&&(r.createConnection=(...s)=>o.destroyed?this.agent.createConnection(...s):o,this.agent.getSession(this[pA],this[_Fe]).catch(()=>{})),u&&this.setTimeout(u),n&&this.once("response",n),this[fte]=!1}get method(){return this[tc][ojt]}set method(t){t&&(this[tc][ojt]=t.toUpperCase())}get path(){let t=this.method==="CONNECT"?zR:sjt;return this[tc][t]}set path(t){if(t){let r=this.method==="CONNECT"?zR:sjt;this[tc][r]=t}}get host(){return this[pA].hostname}set host(t){}get _mustNotHaveABody(){return this.method==="GET"||this.method==="HEAD"||this.method==="DELETE"}_write(t,r,n){if(this._mustNotHaveABody){n(new Error("The GET, HEAD and DELETE methods must NOT have a body"));return}this.flushHeaders();let u=()=>this._request.write(t,r,n);this._request?u():this[hA].push(u)}_final(t){this.flushHeaders();let r=()=>{if(this._mustNotHaveABody||this.method==="CONNECT"){t();return}this._request.end(t)};this._request?r():this[hA].push(r)}abort(){this.res&&this.res.complete||(this.aborted||process.nextTick(()=>this.emit("abort")),this.aborted=!0,this.destroy())}async _destroy(t,r){this.res&&this.res._dump(),this._request?this._request.destroy():process.nextTick(()=>{this.emit("close")});try{await this[GR]}catch(n){this.aborted&&(t=n)}r(t)}async flushHeaders(){if(this[fte]||this.destroyed)return;this[fte]=!0;let t=this.method===CPn,r=n=>{if(this._request=n,this.destroyed){n.destroy();return}t||vPn(n,this,["timeout","continue"]),n.once("error",i=>{this.destroy(i)}),n.once("aborted",()=>{let{res:i}=this;i?(i.aborted=!0,i.emit("aborted"),i.destroy()):this.destroy(new Error("The server aborted the HTTP/2 stream"))});let u=(i,o,s)=>{let a=new gPn(this.socket,n.readableHighWaterMark);this.res=a,a.url=`${this[pA].origin}${this.path}`,a.req=this,a.statusCode=i[ijt],a.headers=i,a.rawHeaders=s,a.once("end",()=>{a.complete=!0,a.socket=null,a.connection=null}),t?(a.upgrade=!0,this.emit("connect",a,n,Buffer.alloc(0))?this.emit("close"):n.destroy()):(n.on("data",c=>{!a._dumped&&!a.push(c)&&n.pause()}),n.once("end",()=>{this.aborted||a.push(null)}),this.emit("response",a)||a._dump())};n.once("response",u),n.once("headers",i=>this.emit("information",{statusCode:i[ijt]})),n.once("trailers",(i,o,s)=>{let{res:a}=this;if(a===null){u(i,o,s);return}a.trailers=i,a.rawTrailers=s}),n.once("close",()=>{let{aborted:i,res:o}=this;if(o){i&&(o.aborted=!0,o.emit("aborted"),o.destroy());let s=()=>{o.emit("close"),this.destroy(),this.emit("close")};o.readable?o.once("end",s):s();return}if(!this.destroyed){this.destroy(new Error("The HTTP/2 stream has been early terminated")),this.emit("close");return}this.destroy(),this.emit("close")}),this.socket=new Proxy(n,bPn);for(let i of this[hA])i();this[hA].length=0,this.emit("socket",this.socket)};if(!(zR in this[tc])&&!t&&(this[tc][zR]=this[pA].host),this[WR])try{r(this[WR].request(this[tc]))}catch(n){this.destroy(n)}else{this.reusedSocket=!0;try{let n=this.agent.request(this[pA],this[_Fe],this[tc]);this[GR]=n,r(await n),this[GR]=!1}catch(n){this[GR]=!1,this.destroy(n)}}}get connection(){return this.socket}set connection(t){this.socket=t}getHeaderNames(){return Object.keys(this[tc])}hasHeader(t){if(typeof t!="string")throw new lte("name","string",t);return!!this[tc][t.toLowerCase()]}getHeader(t){if(typeof t!="string")throw new lte("name","string",t);return this[tc][t.toLowerCase()]}get headersSent(){return this[fte]}removeHeader(t){if(typeof t!="string")throw new lte("name","string",t);if(this.headersSent)throw new ujt("remove");delete this[tc][t.toLowerCase()]}setHeader(t,r){if(this.headersSent)throw new ujt("set");yPn(t),EPn(t,r);let n=t.toLowerCase();if(n==="connection"){if(r.toLowerCase()==="keep-alive")return;throw new Error(`Invalid 'connection' header: ${r}`)}n==="host"&&this.method==="CONNECT"?this[tc][zR]=r:this[tc][n]=r}setNoDelay(){}setSocketKeepAlive(){}setTimeout(t,r){let n=()=>this._request.setTimeout(t,r);return this._request?n():this[hA].push(n),this}get maxHeadersCount(){if(!this.destroyed&&this._request)return this._request.session.localSettings.maxHeaderListSize}set maxHeadersCount(t){}};ajt.exports=BFe});var ljt=L((i$u,cjt)=>{"use strict";var xPn=require("tls");cjt.exports=(e={},t=xPn.connect)=>new Promise((r,n)=>{let u=!1,i,o=async()=>{await a,i.off("timeout",s),i.off("error",n),e.resolveSocket?(r({alpnProtocol:i.alpnProtocol,socket:i,timeout:u}),u&&(await Promise.resolve(),i.emit("timeout"))):(i.destroy(),r({alpnProtocol:i.alpnProtocol,timeout:u}))},s=async()=>{u=!0,o()},a=(async()=>{try{i=await t(e,o),i.on("error",n),i.once("timeout",s)}catch(c){n(c)}})()})});var pjt=L((o$u,fjt)=>{"use strict";var{isIP:APn}=require("net"),FPn=require("assert"),_Pn=e=>{if(e[0]==="["){let r=e.indexOf("]");return FPn(r!==-1),e.slice(1,r)}let t=e.indexOf(":");return t===-1?e:e.slice(0,t)};fjt.exports=e=>{let t=_Pn(e);return APn(t)?"":t}});var Ejt=L((s$u,VR)=>{"use strict";var{URL:hjt,urlToHttpOptions:djt}=require("url"),mjt=require("http"),SFe=require("https"),BPn=ljt(),wPn=DFe(),{Agent:SPn,globalAgent:OPn}=ME(),TPn=wFe(),PPn=pjt(),gjt=yFe(),vjt=new wPn({maxSize:100}),kPn=new Map,RPn=(e,t,r)=>{t._httpMessage={shouldKeepAlive:!0};let n=()=>{e.emit("free",t,r)};t.on("free",n);let u=()=>{e.removeSocket(t,r)};t.on("close",u);let i=()=>{let{freeSockets:s}=e;for(let a of Object.values(s))if(a.includes(t)){t.destroy();return}};t.on("timeout",i);let o=()=>{e.removeSocket(t,r),t.off("close",u),t.off("free",n),t.off("timeout",i),t.off("agentRemove",o)};t.on("agentRemove",o),e.emit("free",t,r)},Djt=(e,t=new Map,r=void 0)=>async n=>{let u=`${n.host}:${n.port}:${n.ALPNProtocols.sort()}`;if(!e.has(u)){if(t.has(u))return{alpnProtocol:(await t.get(u)).alpnProtocol};let{path:i}=n;n.path=n.socketPath;let o=BPn(n,r);t.set(u,o);try{let s=await o;return e.set(u,s.alpnProtocol),t.delete(u),n.path=i,s}catch(s){throw t.delete(u),n.path=i,s}}return{alpnProtocol:e.get(u)}},yjt=Djt(vjt,kPn);VR.exports=async(e,t,r)=>{if(typeof e=="string"?e=djt(new hjt(e)):e instanceof hjt?e=djt(e):e={...e},typeof t=="function"||t===void 0?(r=t,t=e):t=Object.assign(e,t),t.ALPNProtocols=t.ALPNProtocols||["h2","http/1.1"],!Array.isArray(t.ALPNProtocols)||t.ALPNProtocols.length===0)throw new Error("The `ALPNProtocols` option must be an Array with at least one entry");t.protocol=t.protocol||"https:";let n=t.protocol==="https:";t.host=t.hostname||t.host||"localhost",t.session=t.tlsSession,t.servername=t.servername||PPn(t.headers&&t.headers.host||t.host),t.port=t.port||(n?443:80),t._defaultAgent=n?SFe.globalAgent:mjt.globalAgent;let u=t.resolveProtocol||yjt,{agent:i}=t;if(i!==void 0&&i!==!1&&i.constructor.name!=="Object")throw new Error("The `options.agent` can be only an object `http`, `https` or `http2` properties");if(n){t.resolveSocket=!0;let{socket:o,alpnProtocol:s,timeout:a}=await u(t);if(a){o&&o.destroy();let l=new Error(`Timed out resolving ALPN: ${t.timeout} ms`);throw l.code="ETIMEDOUT",l.ms=t.timeout,l}o&&t.createConnection&&(o.destroy(),o=void 0),delete t.resolveSocket;let c=s==="h2";if(i&&(i=c?i.http2:i.https,t.agent=i),i===void 0&&(i=c?OPn:SFe.globalAgent),o)if(i===!1)o.destroy();else{let l=(c?SPn:SFe.Agent).prototype.createConnection;i.createConnection===l?c?t._reuseSocket=o:RPn(i,o,t):o.destroy()}if(c)return gjt(new TPn(t,r))}else i&&(t.agent=i.http);return gjt(mjt.request(t,r))};VR.exports.protocolCache=vjt;VR.exports.resolveProtocol=yjt;VR.exports.createResolveProtocol=Djt});var OFe=L((a$u,bjt)=>{"use strict";var IPn=require("stream"),jPn=require("tls"),LPn=new jPn.TLSSocket(new IPn.PassThrough)._handle._parentWrap.constructor;bjt.exports=LPn});var PFe=L((c$u,Cjt)=>{"use strict";var TFe=class extends Error{constructor(t,r=""){super(`The proxy server rejected the request with status code ${t} (${r||"empty status message"})`),this.statusCode=t,this.statusMessage=r}};Cjt.exports=TFe});var Ajt=L((l$u,xjt)=>{"use strict";var NPn=(e,t,r)=>{if(!r.some(u=>typeof u==="string"?typeof t===u:t instanceof u)){let u=r.map(i=>typeof i=="string"?i:i.name);throw new TypeError(`Expected '${e}' to be a type of ${u.join(" or ")}, got ${typeof t}`)}};xjt.exports=NPn});var kFe=L((f$u,_jt)=>{"use strict";var{URL:Fjt}=require("url"),pte=Ajt();_jt.exports=(e,t)=>{pte("proxyOptions",t,["object"]),pte("proxyOptions.headers",t.headers,["object","undefined"]),pte("proxyOptions.raw",t.raw,["boolean","undefined"]),pte("proxyOptions.url",t.url,[Fjt,"string"]);let r=new Fjt(t.url);e.proxyOptions={raw:!0,...t,headers:{...t.headers},url:r}}});var hte=L((p$u,Bjt)=>{"use strict";Bjt.exports=e=>{let{username:t,password:r}=e.proxyOptions.url;if(t||r){let n=`${t}:${r}`,u=`Basic ${Buffer.from(n).toString("base64")}`;return{"proxy-authorization":u,authorization:u}}return{}}});var Pjt=L((h$u,Tjt)=>{"use strict";var qPn=require("tls"),MPn=require("http"),wjt=require("https"),UPn=OFe(),{globalAgent:$Pn}=ME(),zPn=PFe(),Sjt=kFe(),WPn=hte(),Ojt=(e,t,r)=>{(async()=>{try{let{proxyOptions:n}=e,{url:u,headers:i,raw:o}=n,s=await $Pn.request(u,n,{...WPn(e),...i,":method":"CONNECT",":authority":`${t.host}:${t.port}`});s.once("error",r),s.once("response",a=>{let c=a[":status"];if(c!==200){r(new zPn(c,""));return}let l=e instanceof wjt.Agent;if(o&&l){t.socket=s;let p=qPn.connect(t);p.once("close",()=>{s.destroy()}),r(null,p);return}let f=new UPn(s);f.encrypted=!1,f._handle.getpeername=p=>{p.family=void 0,p.address=void 0,p.port=void 0},r(null,f)})}catch(n){r(n)}})()},RFe=class extends MPn.Agent{constructor(t){super(t),Sjt(this,t.proxyOptions)}createConnection(t,r){Ojt(this,t,r)}},IFe=class extends wjt.Agent{constructor(t){super(t),Sjt(this,t.proxyOptions)}createConnection(t,r){Ojt(this,t,r)}};Tjt.exports={HttpOverHttp2:RFe,HttpsOverHttp2:IFe}});var LFe=L((d$u,kjt)=>{"use strict";var{Agent:GPn}=ME(),VPn=OFe(),HPn=PFe(),KPn=kFe(),jFe=class extends GPn{constructor(t){super(t),KPn(this,t.proxyOptions)}async createConnection(t,r){let n=`${t.hostname}:${t.port||443}`,[u,i,o]=await this._getProxyStream(n);if(i!==200)throw new HPn(i,o);if(this.proxyOptions.raw)r.socket=u;else{let s=new VPn(u);return s.encrypted=!1,s._handle.getpeername=a=>{a.family=void 0,a.address=void 0,a.port=void 0},s}return super.createConnection(t,r)}};kjt.exports=jFe});var Ijt=L((m$u,Rjt)=>{"use strict";var{globalAgent:YPn}=ME(),XPn=LFe(),JPn=hte(),QPn=e=>new Promise((t,r)=>{e.once("error",r),e.once("response",n=>{e.off("error",r),t(n[":status"])})}),NFe=class extends XPn{async _getProxyStream(t){let{proxyOptions:r}=this,n={...JPn(this),...r.headers,":method":"CONNECT",":authority":t},u=await YPn.request(r.url,r,n),i=await QPn(u);return[u,i,""]}};Rjt.exports=NFe});var Ljt=L((g$u,jjt)=>{"use strict";var ZPn=require("http"),ekn=require("https"),tkn=LFe(),rkn=hte(),nkn=e=>new Promise((t,r)=>{let n=(u,i,o)=>{i.unshift(o),e.off("error",r),t([i,u.statusCode,u.statusMessage])};e.once("error",r),e.once("connect",n)}),dte=class extends tkn{async _getProxyStream(t){let{proxyOptions:r}=this,{url:n,headers:u}=this.proxyOptions,o=(n.protocol==="https:"?ekn:ZPn).request({...r,hostname:n.hostname,port:n.port,path:t,headers:{...rkn(this),...u,host:t},method:"CONNECT"}).end();return nkn(o)}};jjt.exports={Http2OverHttp:dte,Http2OverHttps:dte}});var qjt=L((v$u,Njt)=>{"use strict";var ukn=require("http2"),{Agent:ikn,globalAgent:okn}=ME(),qFe=wFe(),skn=CFe(),akn=Ejt(),{HttpOverHttp2:ckn,HttpsOverHttp2:lkn}=Pjt(),fkn=Ijt(),{Http2OverHttp:pkn,Http2OverHttps:hkn}=Ljt(),dkn=xFe(),mkn=AFe(),gkn=(e,t,r)=>new qFe(e,t,r),vkn=(e,t,r)=>{let n=new qFe(e,t,r);return n.end(),n};Njt.exports={...ukn,ClientRequest:qFe,IncomingMessage:skn,Agent:ikn,globalAgent:okn,request:gkn,get:vkn,auto:akn,proxies:{HttpOverHttp2:ckn,HttpsOverHttp2:lkn,Http2OverHttp2:fkn,Http2OverHttp:pkn,Http2OverHttps:hkn},validateHeaderName:dkn,validateHeaderValue:mkn}});var nLt=L((gzu,rLt)=>{"use strict";var WFe=1,tLt=2;function Nkn(){return""}function qkn(e,t,r){return e.slice(t,r).replace(/\S/g," ")}rLt.exports=function(e,t){t=t||{};for(var r,n,u=!1,i=!1,o=0,s="",a=t.whitespace===!1?Nkn:qkn,c=0;c<e.length;c++){if(r=e[c],n=e[c+1],!i&&r==='"'){var l=e[c-1]==="\\"&&e[c-2]!=="\\";l||(u=!u)}if(!u){if(!i&&r+n==="//")s+=e.slice(o,c),o=c,i=WFe,c++;else if(i===WFe&&r+n===`\r
595
595
  `){c++,i=!1,s+=a(e,o,c),o=c;continue}else if(i===WFe&&r===`
@@ -754,7 +754,7 @@ Example:
754
754
  $ s init https://github.com/foo/bar.git
755
755
 
756
756
  ${(0,Pt.emoji)("\u{1F4D6}")} Document: ${Dt.underline("https://serverless.help/t/s/init")}
757
- ${(0,Pt.emoji)("\u{1F680}")} More applications: ${Dt.underline("https://registry.serverless-devs.com")}`,E$t=e=>{e.command("init").usage("[options]").description(WNn).summary(`${(0,Pt.emoji)("\u{1F49E}")} Initializing a serverless project`).helpOption("-h, --help","Display help for command").option("-d, --dir <dir>","Where to output the initialized app into (default: ./<ProjectName> )").option("-r, --registry <url>","Use specify registry").option("--uri <uri>","Use specify uri, Eg: remote url, local dir, local zip file").option("-y","Assume that the answer to any question which would be asked is yes").option("--parameters <parameters>","Initialize with custom parameters").option("--app-name <appName>","Modify default Application name").action(async t=>{if(t.parameters)try{t.parameters=JSON.parse(t.parameters)}catch{throw new Error("--parameters format error")}let r=process.argv[3];r&&!(r!=null&&r.startsWith("-"))&&(t.project=r),await new LE({...t,...e.optsWithGlobals()}).init()})}});var rF=L(MBe=>{"use strict";Object.defineProperty(MBe,"__esModule",{value:!0});var qBe=class{constructor(){this.logger=console}set(t){return this.logger=t||console,this.logger}log(...t){this.logger.log(...t)}debug(...t){this.logger.debug(...t)}info(...t){this.logger.info(...t)}error(...t){this.logger.error(...t)}warn(...t){this.logger.warn(...t)}};MBe.default=new qBe});var x$t=L((WHu,UBe)=>{"use strict";var GNn=require("os"),VNn=require("fs"),C$t=()=>{if(process.platform!=="linux")return!1;if(GNn.release().includes("Microsoft"))return!0;try{return VNn.readFileSync("/proc/version","utf8").includes("Microsoft")}catch{return!1}};process.env.__IS_WSL_TEST__?UBe.exports=C$t:UBe.exports=C$t()});var _$t=L((GHu,F$t)=>{"use strict";var{promisify:HNn}=require("util"),KNn=require("path"),A$t=require("child_process"),$Be=x$t(),YNn=HNn(A$t.execFile),XNn=async e=>{let{stdout:t}=await YNn("wslpath",["-w",e]);return t.trim()};F$t.exports=async(e,t)=>{if(typeof e!="string")throw new TypeError("Expected a `target`");t={wait:!1,...t};let r,n=[],u=[],i={};if(Array.isArray(t.app)&&(n=t.app.slice(1),t.app=t.app[0]),process.platform==="darwin")r="open",t.wait&&u.push("-W"),t.app&&u.push("-a",t.app);else if(process.platform==="win32"||$Be){if(r="cmd"+($Be?".exe":""),u.push("/c","start",'""',"/b"),e=e.replace(/&/g,"^&"),t.wait&&u.push("/wait"),t.app){if($Be&&t.app.startsWith("/mnt/")){let s=await XNn(t.app);t.app=s}u.push(t.app)}n.length>0&&u.push(...n)}else t.app?r=t.app:r=process.versions.electron||process.platform==="android"?"xdg-open":KNn.join(__dirname,"xdg-open"),n.length>0&&u.push(...n),t.wait||(i.stdio="ignore",i.detached=!0);u.push(e),process.platform==="darwin"&&n.length>0&&u.push("--args",...n);let o=A$t.spawn(r,u,i);return t.wait?new Promise((s,a)=>{o.once("error",a),o.once("close",c=>{if(c>0){a(new Error(`Exited with code ${c}`));return}s(o)})}):(o.unref(),o)}});var w$t=L(Of=>{"use strict";var Qre=Of&&Of.__awaiter||function(e,t,r,n){function u(i){return i instanceof r?i:new r(function(o){o(i)})}return new(r||(r=Promise))(function(i,o){function s(l){try{c(n.next(l))}catch(f){o(f)}}function a(l){try{c(n.throw(l))}catch(f){o(f)}}function c(l){l.done?i(l.value):u(l.value).then(s,a)}c((n=n.apply(e,t||[])).next())})},Zre=Of&&Of.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(Of,"__esModule",{value:!0});Of.request_put=Of.new_request_remove=Of.new_request_post=Of.new_request_get=void 0;var JNn=Zre(require("fs")),ene=Zre(require("https")),tne=Zre(require("http")),QNn=Zre(require("querystring")),B$t=Hr(),ZNn=(e,t)=>Qre(void 0,void 0,void 0,function*(){let r=new URL(e),n=e.toLowerCase().startsWith("https:")?ene.default:tne.default;return new Promise(u=>{let i=[];n.get(r.href,{headers:t},o=>{o.on("data",s=>{i.push(s)}),o.on("end",()=>{let s=JSON.parse(Buffer.concat(i).toString());u(s)})})})});Of.new_request_get=ZNn;var eqn=(e,t)=>Qre(void 0,void 0,void 0,function*(){let r=B$t.registry.getSignHeaders(),n=new URL(e),u=e.toLowerCase().startsWith("https:")?ene.default:tne.default,i={hostname:n.hostname,path:n.pathname,method:"POST",headers:Object.assign(Object.assign({},r),{"Content-Type":"application/x-www-form-urlencoded"})};return new Promise(o=>{let s=[],a=u.request(i,c=>{c.on("data",l=>{s.push(l)}),c.on("end",()=>{let l=Buffer.concat(s).toString();o(JSON.parse(l))})});if(t){let c=QNn.default.stringify(t);a.write(c)}a.end()})});Of.new_request_post=eqn;var tqn=e=>Qre(void 0,void 0,void 0,function*(){let t=new URL(e),r=e.toLowerCase().startsWith("https:")?ene.default:tne.default,n=B$t.registry.getSignHeaders(),u={hostname:t.hostname,path:t.pathname,method:"DELETE",headers:Object.assign(Object.assign({},n),{"Content-Type":"application/x-www-form-urlencoded"})};return new Promise(i=>{let o=[];r.request(u,a=>{a.on("data",c=>{o.push(c)}),a.on("end",()=>{let c=Buffer.concat(o).toString();i(JSON.parse(c))})}).end()})});Of.new_request_remove=tqn;var rqn=(e,t)=>Qre(void 0,void 0,void 0,function*(){let r=new URL(e),n=e.toLowerCase().startsWith("https:")?ene.default:tne.default,u={method:"PUT"},i=JNn.default.readFileSync(t);return new Promise(o=>{let s=[],a=n.request(r,u,c=>{c.on("data",l=>{s.push(l)}),c.on("end",()=>{o(Buffer.concat(s).toString())})});a.write(i),a.end()})});Of.request_put=rqn});var pj=L(xo=>{"use strict";var nqn=xo&&xo.__createBinding||(Object.create?function(e,t,r,n){n===void 0&&(n=r);var u=Object.getOwnPropertyDescriptor(t,r);(!u||("get"in u?!t.__esModule:u.writable||u.configurable))&&(u={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,n,u)}:function(e,t,r,n){n===void 0&&(n=r),e[n]=t[r]}),uqn=xo&&xo.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),iqn=xo&&xo.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(e!=null)for(var r in e)r!=="default"&&Object.prototype.hasOwnProperty.call(e,r)&&nqn(t,e,r);return uqn(t,e),t},oqn=xo&&xo.__awaiter||function(e,t,r,n){function u(i){return i instanceof r?i:new r(function(o){o(i)})}return new(r||(r=Promise))(function(i,o){function s(l){try{c(n.next(l))}catch(f){o(f)}}function a(l){try{c(n.throw(l))}catch(f){o(f)}}function c(l){l.done?i(l.value):u(l.value).then(s,a)}c((n=n.apply(e,t||[])).next())})},sqn=xo&&xo.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(xo,"__esModule",{value:!0});xo.sleep=xo.writeFile=xo.getContentText=xo.getYamlContentText=xo.request=void 0;var nF=sqn(require("fs")),S$t=Hr();xo.request=iqn(w$t());var aqn=e=>{let t=(0,S$t.getYamlPath)(e);if(t)return nF.default.readFileSync(t,"utf-8")};xo.getYamlContentText=aqn;var cqn=e=>{if(nF.default.existsSync(e))return nF.default.readFileSync(e,"utf-8")};xo.getContentText=cqn;function lqn(e){let t=S$t.registry.getPlatformPath(),r=nF.default.openSync(t,"w+");nF.default.writeSync(r,e),nF.default.closeSync(r)}xo.writeFile=lqn;var fqn=e=>oqn(void 0,void 0,void 0,function*(){return yield new Promise(t=>setTimeout(t,e))});xo.sleep=fqn});var hj=L(Hc=>{"use strict";Object.defineProperty(Hc,"__esModule",{value:!0});Hc.getPackageUrl=Hc.getDetailLatestUrl=Hc.getDetailUrl=Hc.PUBLISH_URL=Hc.RESET_URL=Hc.GITHUB_LOGIN_URL=Hc.REGISTRY_INFORMATION_GITHUB=void 0;var v3="https://api.devsapp.cn/v3";Hc.REGISTRY_INFORMATION_GITHUB=`${v3}/user/check`;Hc.GITHUB_LOGIN_URL=`https://github.com/login/oauth/authorize?client_id=ef1df7f4f6b9e5a343af&redirect_uri=${v3}/user/login`;Hc.RESET_URL=`${v3}/user/token`;Hc.PUBLISH_URL=`${v3}/packages/releases`;var pqn=e=>`${v3}/packages/${e}/release`;Hc.getDetailUrl=pqn;var hqn=e=>`${v3}/packages/${e}/release/latest`;Hc.getDetailLatestUrl=hqn;var dqn=(e,t)=>`${v3}/packages/${e}/release/tags/${t}`;Hc.getPackageUrl=dqn});var T$t=L(Rd=>{"use strict";var WBe=Rd&&Rd.__awaiter||function(e,t,r,n){function u(i){return i instanceof r?i:new r(function(o){o(i)})}return new(r||(r=Promise))(function(i,o){function s(l){try{c(n.next(l))}catch(f){o(f)}}function a(l){try{c(n.throw(l))}catch(f){o(f)}}function c(l){l.done?i(l.value):u(l.value).then(s,a)}c((n=n.apply(e,t||[])).next())})},GBe=Rd&&Rd.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(Rd,"__esModule",{value:!0});Rd.resetToken=Rd.generateToken=void 0;var mqn=GBe(ZB()),gqn=GBe(_$t()),uF=pj(),kd=GBe(rF()),zBe=hj();function O$t(){return WBe(this,void 0,void 0,function*(){let e=(0,mqn.default)({length:20}),t=`${zBe.GITHUB_LOGIN_URL}?token=${e}`;kd.default.warn("Serverless registry no longer provides independent registration function, but will uniformly adopt GitHub authorized login scheme."),kd.default.info("The system will attempt to automatically open the browser for authorization......"),kd.default.info("If the browser is not opened automatically, please try to open the following URL manually for authorization."),kd.default.info(t);try{(0,gqn.default)(t)}catch{}for(let r=0;r<100;r++){yield(0,uF.sleep)(2e3);let n=yield uF.request.new_request_get(`${zBe.REGISTRY_INFORMATION_GITHUB}?token=${e}`),{body:u,request_id:i}=n||{};if(kd.default.debug(`ResponseId: ${i}`),typeof u=="string"){if(!["\u83B7\u53D6\u767B\u9646 Token \u5931\u8D25","Failed to obtain login token"].includes(u))throw new Error(u);kd.default.debug(`Response body: ${u}`)}if(u.safety_code){(0,uF.writeFile)(u.safety_code),kd.default.log(`Hi ${u.name}, Welcome to Serverless Devs Registry.`);return}}kd.default.error("Login failed. Please log in to GitHub account on the pop-up page and authorize it, or try again later.")})}Rd.generateToken=O$t;function vqn(){return WBe(this,void 0,void 0,function*(){try{let{body:e,request_id:t}=yield uF.request.new_request_post(zBe.RESET_URL);if(kd.default.debug(`ResponseId: ${t}`),typeof e=="string")throw new Error(e);(0,uF.writeFile)(e.safety_code)}catch{throw new Error("Network exception. Please try again later")}kd.default.log("Serverless Registry login token reset succeeded.")})}Rd.resetToken=vqn;function Dqn(e){return WBe(this,void 0,void 0,function*(){if(e){(0,uF.writeFile)(e),kd.default.log("Welcome to Serverless Devs Registry.");return}yield O$t()})}Rd.default=Dqn});var k$t=L((XHu,P$t)=>{var yqn=typeof process=="object"&&process&&process.platform==="win32";P$t.exports=yqn?{sep:"\\"}:{sep:"/"}});var q$t=L((QHu,XBe)=>{var I0=XBe.exports=(e,t,r={})=>(rne(t),!r.nocomment&&t.charAt(0)==="#"?!1:new iF(t,r).match(e));XBe.exports=I0;var KBe=k$t();I0.sep=KBe.sep;var Id=Symbol("globstar **");I0.GLOBSTAR=Id;var Eqn=Ute(),R$t={"!":{open:"(?:(?!(?:",close:"))[^/]*?)"},"?":{open:"(?:",close:")?"},"+":{open:"(?:",close:")+"},"*":{open:"(?:",close:")*"},"@":{open:"(?:",close:")"}},YBe="[^/]",VBe=YBe+"*?",bqn="(?:(?!(?:\\/|^)(?:\\.{1,2})($|\\/)).)*?",Cqn="(?:(?!(?:\\/|^)\\.).)*?",L$t=e=>e.split("").reduce((t,r)=>(t[r]=!0,t),{}),I$t=L$t("().*{}+?[]^$\\!"),xqn=L$t("[.("),j$t=/\/+/;I0.filter=(e,t={})=>(r,n,u)=>I0(r,e,t);var hv=(e,t={})=>{let r={};return Object.keys(e).forEach(n=>r[n]=e[n]),Object.keys(t).forEach(n=>r[n]=t[n]),r};I0.defaults=e=>{if(!e||typeof e!="object"||!Object.keys(e).length)return I0;let t=I0,r=(n,u,i)=>t(n,u,hv(e,i));return r.Minimatch=class extends t.Minimatch{constructor(u,i){super(u,hv(e,i))}},r.Minimatch.defaults=n=>t.defaults(hv(e,n)).Minimatch,r.filter=(n,u)=>t.filter(n,hv(e,u)),r.defaults=n=>t.defaults(hv(e,n)),r.makeRe=(n,u)=>t.makeRe(n,hv(e,u)),r.braceExpand=(n,u)=>t.braceExpand(n,hv(e,u)),r.match=(n,u,i)=>t.match(n,u,hv(e,i)),r};I0.braceExpand=(e,t)=>N$t(e,t);var N$t=(e,t={})=>(rne(e),t.nobrace||!/\{(?:(?!\{).)*\}/.test(e)?[e]:Eqn(e)),Aqn=1024*64,rne=e=>{if(typeof e!="string")throw new TypeError("invalid pattern");if(e.length>Aqn)throw new TypeError("pattern is too long")},HBe=Symbol("subparse");I0.makeRe=(e,t)=>new iF(e,t||{}).makeRe();I0.match=(e,t,r={})=>{let n=new iF(t,r);return e=e.filter(u=>n.match(u)),n.options.nonull&&!e.length&&e.push(t),e};var Fqn=e=>e.replace(/\\(.)/g,"$1"),_qn=e=>e.replace(/\\([^-\]])/g,"$1"),Bqn=e=>e.replace(/[-[\]{}()*+?.,\\^$|#\s]/g,"\\$&"),wqn=e=>e.replace(/[[\]\\]/g,"\\$&"),iF=class{constructor(t,r){rne(t),r||(r={}),this.options=r,this.set=[],this.pattern=t,this.windowsPathsNoEscape=!!r.windowsPathsNoEscape||r.allowWindowsEscape===!1,this.windowsPathsNoEscape&&(this.pattern=this.pattern.replace(/\\/g,"/")),this.regexp=null,this.negate=!1,this.comment=!1,this.empty=!1,this.partial=!!r.partial,this.make()}debug(){}make(){let t=this.pattern,r=this.options;if(!r.nocomment&&t.charAt(0)==="#"){this.comment=!0;return}if(!t){this.empty=!0;return}this.parseNegate();let n=this.globSet=this.braceExpand();r.debug&&(this.debug=(...u)=>console.error(...u)),this.debug(this.pattern,n),n=this.globParts=n.map(u=>u.split(j$t)),this.debug(this.pattern,n),n=n.map((u,i,o)=>u.map(this.parse,this)),this.debug(this.pattern,n),n=n.filter(u=>u.indexOf(!1)===-1),this.debug(this.pattern,n),this.set=n}parseNegate(){if(this.options.nonegate)return;let t=this.pattern,r=!1,n=0;for(let u=0;u<t.length&&t.charAt(u)==="!";u++)r=!r,n++;n&&(this.pattern=t.slice(n)),this.negate=r}matchOne(t,r,n){var u=this.options;this.debug("matchOne",{this:this,file:t,pattern:r}),this.debug("matchOne",t.length,r.length);for(var i=0,o=0,s=t.length,a=r.length;i<s&&o<a;i++,o++){this.debug("matchOne loop");var c=r[o],l=t[i];if(this.debug(r,c,l),c===!1)return!1;if(c===Id){this.debug("GLOBSTAR",[r,c,l]);var f=i,p=o+1;if(p===a){for(this.debug("** at the end");i<s;i++)if(t[i]==="."||t[i]===".."||!u.dot&&t[i].charAt(0)===".")return!1;return!0}for(;f<s;){var h=t[f];if(this.debug(`
757
+ ${(0,Pt.emoji)("\u{1F680}")} More applications: ${Dt.underline("https://registry.serverless-devs.com")}`,E$t=e=>{e.command("init").usage("[options]").description(WNn).summary(`${(0,Pt.emoji)("\u{1F49E}")} Initializing a serverless project`).helpOption("-h, --help","Display help for command").option("-d, --dir <dir>","Where to output the initialized app into (default: ./<ProjectName> )").option("-r, --registry <url>","Use specify registry").option("--uri <uri>","Use specify uri, Eg: remote url, local dir, local zip file").option("-y","Assume that the answer to any question which would be asked is yes").option("--parameters <parameters>","Initialize with custom parameters").option("--app-name <appName>","Modify default Application name").option("--no-overwrite","Only overwrite files with the same name").action(async t=>{if(t.parameters)try{t.parameters=JSON.parse(t.parameters)}catch{throw new Error("--parameters format error")}let r=process.argv[3];r&&!(r!=null&&r.startsWith("-"))&&(t.project=r),await new LE({...t,...e.optsWithGlobals()}).init()})}});var rF=L(MBe=>{"use strict";Object.defineProperty(MBe,"__esModule",{value:!0});var qBe=class{constructor(){this.logger=console}set(t){return this.logger=t||console,this.logger}log(...t){this.logger.log(...t)}debug(...t){this.logger.debug(...t)}info(...t){this.logger.info(...t)}error(...t){this.logger.error(...t)}warn(...t){this.logger.warn(...t)}};MBe.default=new qBe});var x$t=L((WHu,UBe)=>{"use strict";var GNn=require("os"),VNn=require("fs"),C$t=()=>{if(process.platform!=="linux")return!1;if(GNn.release().includes("Microsoft"))return!0;try{return VNn.readFileSync("/proc/version","utf8").includes("Microsoft")}catch{return!1}};process.env.__IS_WSL_TEST__?UBe.exports=C$t:UBe.exports=C$t()});var _$t=L((GHu,F$t)=>{"use strict";var{promisify:HNn}=require("util"),KNn=require("path"),A$t=require("child_process"),$Be=x$t(),YNn=HNn(A$t.execFile),XNn=async e=>{let{stdout:t}=await YNn("wslpath",["-w",e]);return t.trim()};F$t.exports=async(e,t)=>{if(typeof e!="string")throw new TypeError("Expected a `target`");t={wait:!1,...t};let r,n=[],u=[],i={};if(Array.isArray(t.app)&&(n=t.app.slice(1),t.app=t.app[0]),process.platform==="darwin")r="open",t.wait&&u.push("-W"),t.app&&u.push("-a",t.app);else if(process.platform==="win32"||$Be){if(r="cmd"+($Be?".exe":""),u.push("/c","start",'""',"/b"),e=e.replace(/&/g,"^&"),t.wait&&u.push("/wait"),t.app){if($Be&&t.app.startsWith("/mnt/")){let s=await XNn(t.app);t.app=s}u.push(t.app)}n.length>0&&u.push(...n)}else t.app?r=t.app:r=process.versions.electron||process.platform==="android"?"xdg-open":KNn.join(__dirname,"xdg-open"),n.length>0&&u.push(...n),t.wait||(i.stdio="ignore",i.detached=!0);u.push(e),process.platform==="darwin"&&n.length>0&&u.push("--args",...n);let o=A$t.spawn(r,u,i);return t.wait?new Promise((s,a)=>{o.once("error",a),o.once("close",c=>{if(c>0){a(new Error(`Exited with code ${c}`));return}s(o)})}):(o.unref(),o)}});var w$t=L(Of=>{"use strict";var Qre=Of&&Of.__awaiter||function(e,t,r,n){function u(i){return i instanceof r?i:new r(function(o){o(i)})}return new(r||(r=Promise))(function(i,o){function s(l){try{c(n.next(l))}catch(f){o(f)}}function a(l){try{c(n.throw(l))}catch(f){o(f)}}function c(l){l.done?i(l.value):u(l.value).then(s,a)}c((n=n.apply(e,t||[])).next())})},Zre=Of&&Of.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(Of,"__esModule",{value:!0});Of.request_put=Of.new_request_remove=Of.new_request_post=Of.new_request_get=void 0;var JNn=Zre(require("fs")),ene=Zre(require("https")),tne=Zre(require("http")),QNn=Zre(require("querystring")),B$t=Hr(),ZNn=(e,t)=>Qre(void 0,void 0,void 0,function*(){let r=new URL(e),n=e.toLowerCase().startsWith("https:")?ene.default:tne.default;return new Promise(u=>{let i=[];n.get(r.href,{headers:t},o=>{o.on("data",s=>{i.push(s)}),o.on("end",()=>{let s=JSON.parse(Buffer.concat(i).toString());u(s)})})})});Of.new_request_get=ZNn;var eqn=(e,t)=>Qre(void 0,void 0,void 0,function*(){let r=B$t.registry.getSignHeaders(),n=new URL(e),u=e.toLowerCase().startsWith("https:")?ene.default:tne.default,i={hostname:n.hostname,path:n.pathname,method:"POST",headers:Object.assign(Object.assign({},r),{"Content-Type":"application/x-www-form-urlencoded"})};return new Promise(o=>{let s=[],a=u.request(i,c=>{c.on("data",l=>{s.push(l)}),c.on("end",()=>{let l=Buffer.concat(s).toString();o(JSON.parse(l))})});if(t){let c=QNn.default.stringify(t);a.write(c)}a.end()})});Of.new_request_post=eqn;var tqn=e=>Qre(void 0,void 0,void 0,function*(){let t=new URL(e),r=e.toLowerCase().startsWith("https:")?ene.default:tne.default,n=B$t.registry.getSignHeaders(),u={hostname:t.hostname,path:t.pathname,method:"DELETE",headers:Object.assign(Object.assign({},n),{"Content-Type":"application/x-www-form-urlencoded"})};return new Promise(i=>{let o=[];r.request(u,a=>{a.on("data",c=>{o.push(c)}),a.on("end",()=>{let c=Buffer.concat(o).toString();i(JSON.parse(c))})}).end()})});Of.new_request_remove=tqn;var rqn=(e,t)=>Qre(void 0,void 0,void 0,function*(){let r=new URL(e),n=e.toLowerCase().startsWith("https:")?ene.default:tne.default,u={method:"PUT"},i=JNn.default.readFileSync(t);return new Promise(o=>{let s=[],a=n.request(r,u,c=>{c.on("data",l=>{s.push(l)}),c.on("end",()=>{o(Buffer.concat(s).toString())})});a.write(i),a.end()})});Of.request_put=rqn});var pj=L(xo=>{"use strict";var nqn=xo&&xo.__createBinding||(Object.create?function(e,t,r,n){n===void 0&&(n=r);var u=Object.getOwnPropertyDescriptor(t,r);(!u||("get"in u?!t.__esModule:u.writable||u.configurable))&&(u={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,n,u)}:function(e,t,r,n){n===void 0&&(n=r),e[n]=t[r]}),uqn=xo&&xo.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),iqn=xo&&xo.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(e!=null)for(var r in e)r!=="default"&&Object.prototype.hasOwnProperty.call(e,r)&&nqn(t,e,r);return uqn(t,e),t},oqn=xo&&xo.__awaiter||function(e,t,r,n){function u(i){return i instanceof r?i:new r(function(o){o(i)})}return new(r||(r=Promise))(function(i,o){function s(l){try{c(n.next(l))}catch(f){o(f)}}function a(l){try{c(n.throw(l))}catch(f){o(f)}}function c(l){l.done?i(l.value):u(l.value).then(s,a)}c((n=n.apply(e,t||[])).next())})},sqn=xo&&xo.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(xo,"__esModule",{value:!0});xo.sleep=xo.writeFile=xo.getContentText=xo.getYamlContentText=xo.request=void 0;var nF=sqn(require("fs")),S$t=Hr();xo.request=iqn(w$t());var aqn=e=>{let t=(0,S$t.getYamlPath)(e);if(t)return nF.default.readFileSync(t,"utf-8")};xo.getYamlContentText=aqn;var cqn=e=>{if(nF.default.existsSync(e))return nF.default.readFileSync(e,"utf-8")};xo.getContentText=cqn;function lqn(e){let t=S$t.registry.getPlatformPath(),r=nF.default.openSync(t,"w+");nF.default.writeSync(r,e),nF.default.closeSync(r)}xo.writeFile=lqn;var fqn=e=>oqn(void 0,void 0,void 0,function*(){return yield new Promise(t=>setTimeout(t,e))});xo.sleep=fqn});var hj=L(Hc=>{"use strict";Object.defineProperty(Hc,"__esModule",{value:!0});Hc.getPackageUrl=Hc.getDetailLatestUrl=Hc.getDetailUrl=Hc.PUBLISH_URL=Hc.RESET_URL=Hc.GITHUB_LOGIN_URL=Hc.REGISTRY_INFORMATION_GITHUB=void 0;var v3="https://api.devsapp.cn/v3";Hc.REGISTRY_INFORMATION_GITHUB=`${v3}/user/check`;Hc.GITHUB_LOGIN_URL=`https://github.com/login/oauth/authorize?client_id=ef1df7f4f6b9e5a343af&redirect_uri=${v3}/user/login`;Hc.RESET_URL=`${v3}/user/token`;Hc.PUBLISH_URL=`${v3}/packages/releases`;var pqn=e=>`${v3}/packages/${e}/release`;Hc.getDetailUrl=pqn;var hqn=e=>`${v3}/packages/${e}/release/latest`;Hc.getDetailLatestUrl=hqn;var dqn=(e,t)=>`${v3}/packages/${e}/release/tags/${t}`;Hc.getPackageUrl=dqn});var T$t=L(Rd=>{"use strict";var WBe=Rd&&Rd.__awaiter||function(e,t,r,n){function u(i){return i instanceof r?i:new r(function(o){o(i)})}return new(r||(r=Promise))(function(i,o){function s(l){try{c(n.next(l))}catch(f){o(f)}}function a(l){try{c(n.throw(l))}catch(f){o(f)}}function c(l){l.done?i(l.value):u(l.value).then(s,a)}c((n=n.apply(e,t||[])).next())})},GBe=Rd&&Rd.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(Rd,"__esModule",{value:!0});Rd.resetToken=Rd.generateToken=void 0;var mqn=GBe(ZB()),gqn=GBe(_$t()),uF=pj(),kd=GBe(rF()),zBe=hj();function O$t(){return WBe(this,void 0,void 0,function*(){let e=(0,mqn.default)({length:20}),t=`${zBe.GITHUB_LOGIN_URL}?token=${e}`;kd.default.warn("Serverless registry no longer provides independent registration function, but will uniformly adopt GitHub authorized login scheme."),kd.default.info("The system will attempt to automatically open the browser for authorization......"),kd.default.info("If the browser is not opened automatically, please try to open the following URL manually for authorization."),kd.default.info(t);try{(0,gqn.default)(t)}catch{}for(let r=0;r<100;r++){yield(0,uF.sleep)(2e3);let n=yield uF.request.new_request_get(`${zBe.REGISTRY_INFORMATION_GITHUB}?token=${e}`),{body:u,request_id:i}=n||{};if(kd.default.debug(`ResponseId: ${i}`),typeof u=="string"){if(!["\u83B7\u53D6\u767B\u9646 Token \u5931\u8D25","Failed to obtain login token"].includes(u))throw new Error(u);kd.default.debug(`Response body: ${u}`)}if(u.safety_code){(0,uF.writeFile)(u.safety_code),kd.default.log(`Hi ${u.name}, Welcome to Serverless Devs Registry.`);return}}kd.default.error("Login failed. Please log in to GitHub account on the pop-up page and authorize it, or try again later.")})}Rd.generateToken=O$t;function vqn(){return WBe(this,void 0,void 0,function*(){try{let{body:e,request_id:t}=yield uF.request.new_request_post(zBe.RESET_URL);if(kd.default.debug(`ResponseId: ${t}`),typeof e=="string")throw new Error(e);(0,uF.writeFile)(e.safety_code)}catch{throw new Error("Network exception. Please try again later")}kd.default.log("Serverless Registry login token reset succeeded.")})}Rd.resetToken=vqn;function Dqn(e){return WBe(this,void 0,void 0,function*(){if(e){(0,uF.writeFile)(e),kd.default.log("Welcome to Serverless Devs Registry.");return}yield O$t()})}Rd.default=Dqn});var k$t=L((XHu,P$t)=>{var yqn=typeof process=="object"&&process&&process.platform==="win32";P$t.exports=yqn?{sep:"\\"}:{sep:"/"}});var q$t=L((QHu,XBe)=>{var I0=XBe.exports=(e,t,r={})=>(rne(t),!r.nocomment&&t.charAt(0)==="#"?!1:new iF(t,r).match(e));XBe.exports=I0;var KBe=k$t();I0.sep=KBe.sep;var Id=Symbol("globstar **");I0.GLOBSTAR=Id;var Eqn=Ute(),R$t={"!":{open:"(?:(?!(?:",close:"))[^/]*?)"},"?":{open:"(?:",close:")?"},"+":{open:"(?:",close:")+"},"*":{open:"(?:",close:")*"},"@":{open:"(?:",close:")"}},YBe="[^/]",VBe=YBe+"*?",bqn="(?:(?!(?:\\/|^)(?:\\.{1,2})($|\\/)).)*?",Cqn="(?:(?!(?:\\/|^)\\.).)*?",L$t=e=>e.split("").reduce((t,r)=>(t[r]=!0,t),{}),I$t=L$t("().*{}+?[]^$\\!"),xqn=L$t("[.("),j$t=/\/+/;I0.filter=(e,t={})=>(r,n,u)=>I0(r,e,t);var hv=(e,t={})=>{let r={};return Object.keys(e).forEach(n=>r[n]=e[n]),Object.keys(t).forEach(n=>r[n]=t[n]),r};I0.defaults=e=>{if(!e||typeof e!="object"||!Object.keys(e).length)return I0;let t=I0,r=(n,u,i)=>t(n,u,hv(e,i));return r.Minimatch=class extends t.Minimatch{constructor(u,i){super(u,hv(e,i))}},r.Minimatch.defaults=n=>t.defaults(hv(e,n)).Minimatch,r.filter=(n,u)=>t.filter(n,hv(e,u)),r.defaults=n=>t.defaults(hv(e,n)),r.makeRe=(n,u)=>t.makeRe(n,hv(e,u)),r.braceExpand=(n,u)=>t.braceExpand(n,hv(e,u)),r.match=(n,u,i)=>t.match(n,u,hv(e,i)),r};I0.braceExpand=(e,t)=>N$t(e,t);var N$t=(e,t={})=>(rne(e),t.nobrace||!/\{(?:(?!\{).)*\}/.test(e)?[e]:Eqn(e)),Aqn=1024*64,rne=e=>{if(typeof e!="string")throw new TypeError("invalid pattern");if(e.length>Aqn)throw new TypeError("pattern is too long")},HBe=Symbol("subparse");I0.makeRe=(e,t)=>new iF(e,t||{}).makeRe();I0.match=(e,t,r={})=>{let n=new iF(t,r);return e=e.filter(u=>n.match(u)),n.options.nonull&&!e.length&&e.push(t),e};var Fqn=e=>e.replace(/\\(.)/g,"$1"),_qn=e=>e.replace(/\\([^-\]])/g,"$1"),Bqn=e=>e.replace(/[-[\]{}()*+?.,\\^$|#\s]/g,"\\$&"),wqn=e=>e.replace(/[[\]\\]/g,"\\$&"),iF=class{constructor(t,r){rne(t),r||(r={}),this.options=r,this.set=[],this.pattern=t,this.windowsPathsNoEscape=!!r.windowsPathsNoEscape||r.allowWindowsEscape===!1,this.windowsPathsNoEscape&&(this.pattern=this.pattern.replace(/\\/g,"/")),this.regexp=null,this.negate=!1,this.comment=!1,this.empty=!1,this.partial=!!r.partial,this.make()}debug(){}make(){let t=this.pattern,r=this.options;if(!r.nocomment&&t.charAt(0)==="#"){this.comment=!0;return}if(!t){this.empty=!0;return}this.parseNegate();let n=this.globSet=this.braceExpand();r.debug&&(this.debug=(...u)=>console.error(...u)),this.debug(this.pattern,n),n=this.globParts=n.map(u=>u.split(j$t)),this.debug(this.pattern,n),n=n.map((u,i,o)=>u.map(this.parse,this)),this.debug(this.pattern,n),n=n.filter(u=>u.indexOf(!1)===-1),this.debug(this.pattern,n),this.set=n}parseNegate(){if(this.options.nonegate)return;let t=this.pattern,r=!1,n=0;for(let u=0;u<t.length&&t.charAt(u)==="!";u++)r=!r,n++;n&&(this.pattern=t.slice(n)),this.negate=r}matchOne(t,r,n){var u=this.options;this.debug("matchOne",{this:this,file:t,pattern:r}),this.debug("matchOne",t.length,r.length);for(var i=0,o=0,s=t.length,a=r.length;i<s&&o<a;i++,o++){this.debug("matchOne loop");var c=r[o],l=t[i];if(this.debug(r,c,l),c===!1)return!1;if(c===Id){this.debug("GLOBSTAR",[r,c,l]);var f=i,p=o+1;if(p===a){for(this.debug("** at the end");i<s;i++)if(t[i]==="."||t[i]===".."||!u.dot&&t[i].charAt(0)===".")return!1;return!0}for(;f<s;){var h=t[f];if(this.debug(`
758
758
  globstar while`,t,f,r,p,h),this.matchOne(t.slice(f),r.slice(p),n))return this.debug("globstar found match!",f,s,h),!0;if(h==="."||h===".."||!u.dot&&h.charAt(0)==="."){this.debug("dot detected!",t,f,r,p);break}this.debug("globstar swallow a segment, and continue"),f++}return!!(n&&(this.debug(`
759
759
  >>> no match, partial?`,t,f,r,p),f===s))}var d;if(typeof c=="string"?(d=l===c,this.debug("string match",c,l,d)):(d=l.match(c),this.debug("pattern match",c,l,d)),!d)return!1}if(i===s&&o===a)return!0;if(i===s)return n;if(o===a)return i===s-1&&t[i]==="";throw new Error("wtf?")}braceExpand(){return N$t(this.pattern,this.options)}parse(t,r){rne(t);let n=this.options;if(t==="**")if(n.noglobstar)t="*";else return Id;if(t==="")return"";let u="",i=!1,o=!1,s=[],a=[],c,l=!1,f=-1,p=-1,h,d,m,v=t.charAt(0)===".",y=n.dot||v,g=()=>v?"":y?"(?!(?:^|\\/)\\.{1,2}(?:$|\\/))":"(?!\\.)",D=x=>x.charAt(0)==="."?"":n.dot?"(?!(?:^|\\/)\\.{1,2}(?:$|\\/))":"(?!\\.)",E=()=>{if(c){switch(c){case"*":u+=VBe,i=!0;break;case"?":u+=YBe,i=!0;break;default:u+="\\"+c;break}this.debug("clearStateChar %j %j",c,u),c=!1}};for(let x=0,F;x<t.length&&(F=t.charAt(x));x++){if(this.debug("%s %s %s %j",t,x,u,F),o){if(F==="/")return!1;I$t[F]&&(u+="\\"),u+=F,o=!1;continue}switch(F){case"/":return!1;case"\\":if(l&&t.charAt(x+1)==="-"){u+=F;continue}E(),o=!0;continue;case"?":case"*":case"+":case"@":case"!":if(this.debug("%s %s %s %j <-- stateChar",t,x,u,F),l){this.debug(" in class"),F==="!"&&x===p+1&&(F="^"),u+=F;continue}this.debug("call clearStateChar %j",c),E(),c=F,n.noext&&E();continue;case"(":{if(l){u+="(";continue}if(!c){u+="\\(";continue}let A={type:c,start:x-1,reStart:u.length,open:R$t[c].open,close:R$t[c].close};this.debug(this.pattern," ",A),s.push(A),u+=A.open,A.start===0&&A.type!=="!"&&(v=!0,u+=D(t.slice(x+1))),this.debug("plType %j %j",c,u),c=!1;continue}case")":{let A=s[s.length-1];if(l||!A){u+="\\)";continue}s.pop(),E(),i=!0,d=A,u+=d.close,d.type==="!"&&a.push(Object.assign(d,{reEnd:u.length}));continue}case"|":{let A=s[s.length-1];if(l||!A){u+="\\|";continue}E(),u+="|",A.start===0&&A.type!=="!"&&(v=!0,u+=D(t.slice(x+1)));continue}case"[":if(E(),l){u+="\\"+F;continue}l=!0,p=x,f=u.length,u+=F;continue;case"]":if(x===p+1||!l){u+="\\"+F;continue}h=t.substring(p+1,x);try{RegExp("["+wqn(_qn(h))+"]"),u+=F}catch{u=u.substring(0,f)+"(?:$.)"}i=!0,l=!1;continue;default:E(),I$t[F]&&!(F==="^"&&l)&&(u+="\\"),u+=F;break}}for(l&&(h=t.slice(p+1),m=this.parse(h,HBe),u=u.substring(0,f)+"\\["+m[0],i=i||m[1]),d=s.pop();d;d=s.pop()){let x;x=u.slice(d.reStart+d.open.length),this.debug("setting tail",u,d),x=x.replace(/((?:\\{2}){0,64})(\\?)\|/g,(A,S,B)=>(B||(B="\\"),S+S+B+"|")),this.debug(`tail=%j
760
760
  %s`,x,x,d,u);let F=d.type==="*"?VBe:d.type==="?"?YBe:"\\"+d.type;i=!0,u=u.slice(0,d.reStart)+F+"\\("+x}E(),o&&(u+="\\\\");let b=xqn[u.charAt(0)];for(let x=a.length-1;x>-1;x--){let F=a[x],A=u.slice(0,F.reStart),S=u.slice(F.reStart,F.reEnd-8),B=u.slice(F.reEnd),O=u.slice(F.reEnd-8,F.reEnd)+B,T=A.split(")").length,P=A.split("(").length-T,N=B;for(let $=0;$<P;$++)N=N.replace(/\)[+*?]?/,"");B=N;let j=B===""&&r!==HBe?"(?:$|\\/)":"";u=A+S+B+j+O}if(u!==""&&i&&(u="(?=.)"+u),b&&(u=g()+u),r===HBe)return[u,i];if(n.nocase&&!i&&(i=t.toUpperCase()!==t.toLowerCase()),!i)return Fqn(t);let C=n.nocase?"i":"";try{return Object.assign(new RegExp("^"+u+"$",C),{_glob:t,_src:u})}catch{return new RegExp("$.")}}makeRe(){if(this.regexp||this.regexp===!1)return this.regexp;let t=this.set;if(!t.length)return this.regexp=!1,this.regexp;let r=this.options,n=r.noglobstar?VBe:r.dot?bqn:Cqn,u=r.nocase?"i":"",i=t.map(o=>(o=o.map(s=>typeof s=="string"?Bqn(s):s===Id?Id:s._src).reduce((s,a)=>(s[s.length-1]===Id&&a===Id||s.push(a),s),[]),o.forEach((s,a)=>{s!==Id||o[a-1]===Id||(a===0?o.length>1?o[a+1]="(?:\\/|"+n+"\\/)?"+o[a+1]:o[a]=n:a===o.length-1?o[a-1]+="(?:\\/|"+n+")?":(o[a-1]+="(?:\\/|\\/"+n+"\\/)"+o[a+1],o[a+1]=Id))}),o.filter(s=>s!==Id).join("/"))).join("|");i="^(?:"+i+")$",this.negate&&(i="^(?!"+i+").*$");try{this.regexp=new RegExp(i,u)}catch{this.regexp=!1}return this.regexp}match(t,r=this.partial){if(this.debug("match",t,this.pattern),this.comment)return!1;if(this.empty)return t==="";if(t==="/"&&r)return!0;let n=this.options;KBe.sep!=="/"&&(t=t.split(KBe.sep).join("/")),t=t.split(j$t),this.debug(this.pattern,"split",t);let u=this.set;this.debug(this.pattern,"set",u);let i;for(let o=t.length-1;o>=0&&(i=t[o],!i);o--);for(let o=0;o<u.length;o++){let s=u[o],a=t;if(n.matchBase&&s.length===1&&(a=[i]),this.matchOne(a,s,r))return n.flipNegate?!0:!this.negate}return n.flipNegate?!1:this.negate}static defaults(t){return I0.defaults(t).Minimatch}};I0.Minimatch=iF});var W$t=L((ZHu,z$t)=>{z$t.exports=$$t;var QBe=require("fs"),{EventEmitter:Sqn}=require("events"),{Minimatch:JBe}=q$t(),{resolve:Oqn}=require("path");function Tqn(e,t){return new Promise((r,n)=>{QBe.readdir(e,{withFileTypes:!0},(u,i)=>{if(u)switch(u.code){case"ENOTDIR":t?n(u):r([]);break;case"ENOTSUP":case"ENOENT":case"ENAMETOOLONG":case"UNKNOWN":r([]);break;case"ELOOP":default:n(u);break}else r(i)})})}function M$t(e,t){return new Promise((r,n)=>{(t?QBe.stat:QBe.lstat)(e,(i,o)=>{if(i)switch(i.code){case"ENOENT":r(t?M$t(e,!1):null);break;default:r(null);break}else r(o)})})}async function*U$t(e,t,r,n,u,i){let o=await Tqn(t+e,i);for(let s of o){let a=s.name;a===void 0&&(a=s,n=!0);let c=e+"/"+a,l=c.slice(1),f=t+"/"+l,p=null;(n||r)&&(p=await M$t(f,r)),!p&&s.name!==void 0&&(p=s),p===null&&(p={isDirectory:()=>!1}),p.isDirectory()?u(l)||(yield{relative:l,absolute:f,stats:p},yield*U$t(c,t,r,n,u,!1)):yield{relative:l,absolute:f,stats:p}}}async function*Pqn(e,t,r,n){yield*U$t("",e,t,r,n,!0)}function kqn(e){return{pattern:e.pattern,dot:!!e.dot,noglobstar:!!e.noglobstar,matchBase:!!e.matchBase,nocase:!!e.nocase,ignore:e.ignore,skip:e.skip,follow:!!e.follow,stat:!!e.stat,nodir:!!e.nodir,mark:!!e.mark,silent:!!e.silent,absolute:!!e.absolute}}var nne=class extends Sqn{constructor(t,r,n){if(super(),typeof r=="function"&&(n=r,r=null),this.options=kqn(r||{}),this.matchers=[],this.options.pattern){let u=Array.isArray(this.options.pattern)?this.options.pattern:[this.options.pattern];this.matchers=u.map(i=>new JBe(i,{dot:this.options.dot,noglobstar:this.options.noglobstar,matchBase:this.options.matchBase,nocase:this.options.nocase}))}if(this.ignoreMatchers=[],this.options.ignore){let u=Array.isArray(this.options.ignore)?this.options.ignore:[this.options.ignore];this.ignoreMatchers=u.map(i=>new JBe(i,{dot:!0}))}if(this.skipMatchers=[],this.options.skip){let u=Array.isArray(this.options.skip)?this.options.skip:[this.options.skip];this.skipMatchers=u.map(i=>new JBe(i,{dot:!0}))}this.iterator=Pqn(Oqn(t||"."),this.options.follow,this.options.stat,this._shouldSkipDirectory.bind(this)),this.paused=!1,this.inactive=!1,this.aborted=!1,n&&(this._matches=[],this.on("match",u=>this._matches.push(this.options.absolute?u.absolute:u.relative)),this.on("error",u=>n(u)),this.on("end",()=>n(null,this._matches))),setTimeout(()=>this._next(),0)}_shouldSkipDirectory(t){return this.skipMatchers.some(r=>r.match(t))}_fileMatches(t,r){let n=t+(r?"/":"");return(this.matchers.length===0||this.matchers.some(u=>u.match(n)))&&!this.ignoreMatchers.some(u=>u.match(n))&&(!this.options.nodir||!r)}_next(){!this.paused&&!this.aborted?this.iterator.next().then(t=>{if(t.done)this.emit("end");else{let r=t.value.stats.isDirectory();if(this._fileMatches(t.value.relative,r)){let n=t.value.relative,u=t.value.absolute;this.options.mark&&r&&(n+="/",u+="/"),this.options.stat?this.emit("match",{relative:n,absolute:u,stat:t.value.stats}):this.emit("match",{relative:n,absolute:u})}this._next(this.iterator)}}).catch(t=>{this.abort(),this.emit("error",t),!t.code&&!this.options.silent&&console.error(t)}):this.inactive=!0}abort(){this.aborted=!0}pause(){this.paused=!0}resume(){this.paused=!1,this.inactive&&(this.inactive=!1,this._next())}};function $$t(e,t,r){return new nne(e,t,r)}$$t.ReaddirGlob=nne});var V$t=L((une,G$t)=>{(function(e,t){typeof une=="object"&&typeof G$t<"u"?t(une):typeof define=="function"&&define.amd?define(["exports"],t):(e=typeof globalThis<"u"?globalThis:e||self,t(e.async={}))})(une,function(e){"use strict";function t(Ue,...fe){return(...ce)=>Ue(...fe,...ce)}function r(Ue){return function(...fe){var ce=fe.pop();return Ue.call(this,fe,ce)}}var n=typeof queueMicrotask=="function"&&queueMicrotask,u=typeof setImmediate=="function"&&setImmediate,i=typeof process=="object"&&typeof process.nextTick=="function";function o(Ue){setTimeout(Ue,0)}function s(Ue){return(fe,...ce)=>Ue(()=>fe(...ce))}var a;n?a=queueMicrotask:u?a=setImmediate:i?a=process.nextTick:a=o;var c=s(a);function l(Ue){return h(Ue)?function(...fe){let ce=fe.pop(),ye=Ue.apply(this,fe);return f(ye,ce)}:r(function(fe,ce){var ye;try{ye=Ue.apply(this,fe)}catch(Be){return ce(Be)}if(ye&&typeof ye.then=="function")return f(ye,ce);ce(null,ye)})}function f(Ue,fe){return Ue.then(ce=>{p(fe,null,ce)},ce=>{p(fe,ce&&(ce instanceof Error||ce.message)?ce:new Error(ce))})}function p(Ue,fe,ce){try{Ue(fe,ce)}catch(ye){c(Be=>{throw Be},ye)}}function h(Ue){return Ue[Symbol.toStringTag]==="AsyncFunction"}function d(Ue){return Ue[Symbol.toStringTag]==="AsyncGenerator"}function m(Ue){return typeof Ue[Symbol.asyncIterator]=="function"}function v(Ue){if(typeof Ue!="function")throw new Error("expected a function");return h(Ue)?l(Ue):Ue}function y(Ue,fe){if(fe||(fe=Ue.length),!fe)throw new Error("arity is undefined");function ce(...ye){return typeof ye[fe-1]=="function"?Ue.apply(this,ye):new Promise((Be,Ge)=>{ye[fe-1]=(Ve,...Qe)=>{if(Ve)return Ge(Ve);Be(Qe.length>1?Qe:Qe[0])},Ue.apply(this,ye)})}return ce}function g(Ue){return function(ce,...ye){return y(function(Ge){var Ve=this;return Ue(ce,(Qe,nt)=>{v(Qe).apply(Ve,ye.concat(nt))},Ge)})}}function D(Ue,fe,ce,ye){fe=fe||[];var Be=[],Ge=0,Ve=v(ce);return Ue(fe,(Qe,nt,xt)=>{var jt=Ge++;Ve(Qe,(rr,Ht)=>{Be[jt]=Ht,xt(rr)})},Qe=>{ye(Qe,Be)})}function E(Ue){return Ue&&typeof Ue.length=="number"&&Ue.length>=0&&Ue.length%1===0}var C={};function x(Ue){function fe(...ce){if(Ue!==null){var ye=Ue;Ue=null,ye.apply(this,ce)}}return Object.assign(fe,Ue),fe}function F(Ue){return Ue[Symbol.iterator]&&Ue[Symbol.iterator]()}function A(Ue){var fe=-1,ce=Ue.length;return function(){return++fe<ce?{value:Ue[fe],key:fe}:null}}function S(Ue){var fe=-1;return function(){var ye=Ue.next();return ye.done?null:(fe++,{value:ye.value,key:fe})}}function B(Ue){var fe=Ue?Object.keys(Ue):[],ce=-1,ye=fe.length;return function Be(){var Ge=fe[++ce];return Ge==="__proto__"?Be():ce<ye?{value:Ue[Ge],key:Ge}:null}}function O(Ue){if(E(Ue))return A(Ue);var fe=F(Ue);return fe?S(fe):B(Ue)}function T(Ue){return function(...fe){if(Ue===null)throw new Error("Callback was already called.");var ce=Ue;Ue=null,ce.apply(this,fe)}}function P(Ue,fe,ce,ye){let Be=!1,Ge=!1,Ve=!1,Qe=0,nt=0;function xt(){Qe>=fe||Ve||Be||(Ve=!0,Ue.next().then(({value:Ht,done:Lr})=>{if(!(Ge||Be)){if(Ve=!1,Lr){Be=!0,Qe<=0&&ye(null);return}Qe++,ce(Ht,nt,jt),nt++,xt()}}).catch(rr))}function jt(Ht,Lr){if(Qe-=1,!Ge){if(Ht)return rr(Ht);if(Ht===!1){Be=!0,Ge=!0;return}if(Lr===C||Be&&Qe<=0)return Be=!0,ye(null);xt()}}function rr(Ht){Ge||(Ve=!1,Be=!0,ye(Ht))}xt()}var N=Ue=>(fe,ce,ye)=>{if(ye=x(ye),Ue<=0)throw new RangeError("concurrency limit cannot be less than 1");if(!fe)return ye(null);if(d(fe))return P(fe,Ue,ce,ye);if(m(fe))return P(fe[Symbol.asyncIterator](),Ue,ce,ye);var Be=O(fe),Ge=!1,Ve=!1,Qe=0,nt=!1;function xt(rr,Ht){if(!Ve)if(Qe-=1,rr)Ge=!0,ye(rr);else if(rr===!1)Ge=!0,Ve=!0;else{if(Ht===C||Ge&&Qe<=0)return Ge=!0,ye(null);nt||jt()}}function jt(){for(nt=!0;Qe<Ue&&!Ge;){var rr=Be();if(rr===null){Ge=!0,Qe<=0&&ye(null);return}Qe+=1,ce(rr.value,rr.key,T(xt))}nt=!1}jt()};function j(Ue,fe,ce,ye){return N(fe)(Ue,v(ce),ye)}var $=y(j,4);function W(Ue,fe,ce){ce=x(ce);var ye=0,Be=0,{length:Ge}=Ue,Ve=!1;Ge===0&&ce(null);function Qe(nt,xt){nt===!1&&(Ve=!0),Ve!==!0&&(nt?ce(nt):(++Be===Ge||xt===C)&&ce(null))}for(;ye<Ge;ye++)fe(Ue[ye],ye,T(Qe))}function I(Ue,fe,ce){return $(Ue,1/0,fe,ce)}function U(Ue,fe,ce){var ye=E(Ue)?W:I;return ye(Ue,v(fe),ce)}var z=y(U,3);function V(Ue,fe,ce){return D(z,Ue,fe,ce)}var X=y(V,3),Z=g(X);function ie(Ue,fe,ce){return $(Ue,1,fe,ce)}var te=y(ie,3);function Y(Ue,fe,ce){return D(te,Ue,fe,ce)}var ee=y(Y,3),Q=g(ee);let q=Symbol("promiseCallback");function M(){let Ue,fe;function ce(ye,...Be){if(ye)return fe(ye);Ue(Be.length>1?Be:Be[0])}return ce[q]=new Promise((ye,Be)=>{Ue=ye,fe=Be}),ce}function J(Ue,fe,ce){typeof fe!="number"&&(ce=fe,fe=null),ce=x(ce||M());var ye=Object.keys(Ue).length;if(!ye)return ce(null);fe||(fe=ye);var Be={},Ge=0,Ve=!1,Qe=!1,nt=Object.create(null),xt=[],jt=[],rr={};Object.keys(Ue).forEach(qt=>{var Nt=Ue[qt];if(!Array.isArray(Nt)){Ht(qt,[Nt]),jt.push(qt);return}var Kt=Nt.slice(0,Nt.length-1),sr=Kt.length;if(sr===0){Ht(qt,Nt),jt.push(qt);return}rr[qt]=sr,Kt.forEach(on=>{if(!Ue[on])throw new Error("async.auto task `"+qt+"` has a non-existent dependency `"+on+"` in "+Kt.join(", "));ri(on,()=>{sr--,sr===0&&Ht(qt,Nt)})})}),bn(),Lr();function Ht(qt,Nt){xt.push(()=>Fs(qt,Nt))}function Lr(){if(!Ve){if(xt.length===0&&Ge===0)return ce(null,Be);for(;xt.length&&Ge<fe;){var qt=xt.shift();qt()}}}function ri(qt,Nt){var Kt=nt[qt];Kt||(Kt=nt[qt]=[]),Kt.push(Nt)}function Hs(qt){var Nt=nt[qt]||[];Nt.forEach(Kt=>Kt()),Lr()}function Fs(qt,Nt){if(!Qe){var Kt=T((on,...Ln)=>{if(Ge--,on===!1){Ve=!0;return}if(Ln.length<2&&([Ln]=Ln),on){var ai={};if(Object.keys(Be).forEach(wo=>{ai[wo]=Be[wo]}),ai[qt]=Ln,Qe=!0,nt=Object.create(null),Ve)return;ce(on,ai)}else Be[qt]=Ln,Hs(qt)});Ge++;var sr=v(Nt[Nt.length-1]);Nt.length>1?sr(Be,Kt):sr(Kt)}}function bn(){for(var qt,Nt=0;jt.length;)qt=jt.pop(),Nt++,Jt(qt).forEach(Kt=>{--rr[Kt]===0&&jt.push(Kt)});if(Nt!==ye)throw new Error("async.auto cannot execute tasks due to a recursive dependency")}function Jt(qt){var Nt=[];return Object.keys(Ue).forEach(Kt=>{let sr=Ue[Kt];Array.isArray(sr)&&sr.indexOf(qt)>=0&&Nt.push(Kt)}),Nt}return ce[q]}var re=/^(?:async\s+)?(?:function)?\s*\w*\s*\(\s*([^)]+)\s*\)(?:\s*{)/,ne=/^(?:async\s+)?\(?\s*([^)=]+)\s*\)?(?:\s*=>)/,ue=/,/,ae=/(=.+)?(\s*)$/;function de(Ue){let fe="",ce=0,ye=Ue.indexOf("*/");for(;ce<Ue.length;)if(Ue[ce]==="/"&&Ue[ce+1]==="/"){let Be=Ue.indexOf(`